Hi there

In Scilab I've used interp1 to calculate a cubic spline interpolation, like this:

a(:,1) = interp1(log(f3),a1,log(f),'spline');

a = amplitude (magnitude). f3 is a frequency (27000 linear spaced data), a1 is the original data, f is the resampled 1200 frequencies (log-spaced), where I need the spline to interpolate some data for me.

Above should work OK, but it's not perfect, compared to a Fortran script. The fortran script calculates with its own cubic spline routine, utilizing LAPACK (DGTTRF and DGTTRS) to solve for polynomial coefficients.


The question is - above code line with the interp1 spline, which kind of spline is it?

Digging into interp, I see multiple options. Digging into splin, I also see multiple options.

I looks like the interp1 is using "natural" spline - is this correct?

It's strange because the splin help documentation doesn't recommend this. It says: Don't use the natural type unless the underlying function have zero second end points derivatives.

This might be my problem.

The Scilab help for interp1 doesn't give any examples, but does mention I can add an "extrap" method. Could this be any of the suggestions in the splin documentation. For example, could I write:

a(:,1) = interp1(log(f3),a1,log(f),'spline','not-a-knot');

?

P.S. Since not-a-knot is mentioned as the default for the splin function, I think it should also be made the default for interp1 ... just my two cents.

/Claus

_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to