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].
function interpL input Real u[:] = {1, 2, 3, 4} "The variable of the original data"; input Real y[size(u, 1)] = {0, 1, -1, 2} "The function of the original data"; input Real u1[:] = {0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5} "The variable of the interpolated function"; output Real y1[size(u1, 1)] "The interpolated result at the variable values, u1[:]"; end interpL;