functioninterpL

One-dimensional linear interpolation

Information

This function finds the values at u1 of the linearly interpolated function of the original data pairs, u and y. Both u and u1 must be monotone, meaning, e.g. u[k]>=u[k-1]. For the elements in u1 whose values are less than u[1], the corresponding elements in y1 are set as y[1]. For the elements in u1 whose values are greater than the last value of u, the corresponding elements in y1 are set as y[end].

Inputs

TypeNameDefaultDescription
Real[:]u{1, 2, 3, 4}The variable of the original data
Real[size(u, 1)]y{0, 1, -1, 2}The function of the original data
Real[:]u1{0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5}The variable of the interpolated function

Outputs

TypeNameDefaultDescription
Real[size(u1, 1)]y1The interpolated result at the variable values, u1[:]