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