Hi Uwe,

Have you tried Grid.jl? I haven't tried it, but this example looks like it 
might work with a non-uniform grid.

# Let's define a quadratic function in one dimension, and evaluate it on an 
evenly-spaced grid of 5 points:
c = 2.3  # center
a = 8.1  # quadratic coefficient
o = 1.6  # vertical offset
qfunc = x -> a*(x-c).^2 + o
xg = Float64[1:5]
y = qfunc(xg)
yi = InterpGrid(y, BCnil, InterpQuadratic)




On Saturday, February 27, 2016 at 9:21:53 AM UTC-5, Uwe Fechner wrote:
>
> Hello,
>
> I am trying to port the following function from python to julia:
>
> # -*- coding: utf-8 -*-
> from scipy.interpolate import InterpolatedUnivariateSpline
> import numpy as np
> from pylab import plot
>
> P_NOM = [1.5, 2.2, 3.7, 5.6, 7.5, 11.2, 14.9]
> ETA   = [93., 94., 94., 95., 95., 95.5, 95.5]
>
> calc_eta = InterpolatedUnivariateSpline(P_NOM, ETA, k=1)
>
> # plotting code, only for testing
> if __name__ == "__main__":
>     X = np.linspace(1.5, 14.9, 1024, endpoint=True)
>     ETA = []
>     for alpha in X:
>         eta = calc_eta(alpha)
>         ETA.append(eta)
>     plot(X, ETA)
>
> The resulting plot is shown at the end of this posting.
>
> How can I port this to Julia?
>
> I am trying to use the package "Interpolations.jl", but I do not see any
> example, that shows the interpolation on a non-uniform grid.
>
> For now I need only linear interpolation, but I want to use B-Splines
> later.
>
> Any hint appreciated!
>
> Uwe Fechner
>
>
>
> <https://lh3.googleusercontent.com/-8OofwCQWohg/VtGwKR-1BOI/AAAAAAAAAQI/UTLksCCMIPo/s1600/LinearInterpolation.png>
>

Reply via email to