Cubic spline interpolation function. |
|||
Syntax |
New_y = Spline(Old_x, Old_y, New_x, Option) |
||
Arguments |
Name |
Description |
|
Old_x |
A vector of the x data of the curve to be interpolated. |
||
Old_y |
A vector of the y data of the curve to be interpolated. |
||
New_x |
A vector containing x values for which new y values are to be calculated. |
||
Option (optional) |
Set to "extrap" to allow extrapolation when values of New_x are beyond the range of Old_x. The default is "noextrap." |
||
Output |
Name |
Description |
|
New_y |
A vector of the new y values at the given new x values. |
||
Example |
For a given pair of x values, find the corresponding cubic spline y values. |
||
Syntax |
|||
|
|||
Result |
|||
y = 2.42 20.48 |
|||
Comments |
When the length of Old_y equals the length of Old_x, the “knot a not” end conditions apply. When the length of Old_y is two greater than the length of Old_x, then the “clamped” end conditions apply, and the first and last values of Old_y are used as the first derivatives of the respective endpoints. |
||
See Also: |