2
$\begingroup$

I want to use the Cubic spline interpolation technique so I can interpolate yield curve points. Now I wonder if I can use the standard matlab function interpl1 (and then using the 'spline' method) or does this yield totally different interpolated points?

If this function is not suitable for my purpose where can I can find some code or references to a cubic spline method so I can create a cubic spline function in matlab myself?

Thanks.

$\endgroup$

1 Answer 1

1
$\begingroup$

Why do you think this is not apropriate? Matlabs documentation for 1-D Data interpolation states that interpl1 using method spline is the right way to go:

Spline interpolation using not-a-knot end conditions. The interpolated value at a query point is based on a cubic interpolation of the values at neighboring grid points in each respective dimension.

Therefore just use

interp1($x$,$v$,$xq$,'spline');

where Vector $x$ contains the sample points, and $v$ contains the corresponding values, $v(x)$. Vector $xq$ contains the coordinates of the query points.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.