JuliaMath / Interpolations.jl

Fast, continuous interpolation of discrete datasets in Julia

Home Page:http://juliamath.github.io/Interpolations.jl/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Interpolate a set of points

Mehgugs opened this issue · comments

I have a discrete set of points as supplied as Vector{Float64}s and would like to interpolate between the points... it's not clear from the documentation how to use this package to do so.

I have:

x = [1148.824818, 2312.309814, 2798.761158, 3804.982432, 4577.973609, 5597.522316, 6530.442702, 7616.62858, 7996.460452]
y = [1947.529304, 1979.653498, 2037.209347, 1936.821239, 1703.920827, 1350.554686, 973.0953978, 377.4592877, 105.2281538]

and I want to get a cubic spline interpolator.

For irregular 1D sampling like this, try DataInterpolations.jl.

julia> import DataInterpolations, Plots

julia> itp = DataInterpolations.CubicSpline(y,x);

julia> Plots.plot(itp)

image