# Cubic spline interpolation function within Matlab

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.

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.