Re: SPLINE function [message #79227] |
Sat, 11 February 2012 06:41 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Feb 10, 10:48 am, jen <jenhers...@gmail.com> wrote:
> Just wondering what type of spline the built in IDL SPLINE function
> actually solves?
>
> In the help it just says 'cubic spline interpolation', however there
> are a lot of different types of spline that are based on a cubic
> spline or reduce to a cubic spline depending on the parameters chosen.
> I'd kind of assumed it was a standard cubic spline with natural
> boundary conditions, however I don't think this is right because:
>
> a) There is a tension parameter, which does not exist for a cubic
> spline. According to the IDL help, this gives a cubic spline if the
> tension is set to 0, but the default is 1 - i.e. NOT a cubic spline.
> I've read that rational splines have a tension parameter, but I'm not
> sure if there are any other types of spline which have this?
>
> b) I wrote my own simple cubic spline routine (so that I could try
> different boundary conditions), and it produces slightly different
> results to the built in SPLINE function even when I set it to natural
> boundary conditions.
>
> c) I took a look at the code, and although I don't fully understand
> what it does, I can see some things which are definitely not part of
> the solution to a basic cubic spline. E.g it takes the hyperbolic sine
> & cosine of a function involving the tension parameter & the gradient
> between each pair of nodes, and seems to use this to determine the
> elements of the tridiagonal matrix which is solved to find the spline
> coefficients. I don't know what type of spline would be solved in this
> way?
I don't have a lot of insight into how SPLINE works, but I do remember
that early on, SPLINE didn't work well for me and I abandoned it. ( I
think it was a robustness thing. )
I've used SPL_INIT and SPL_INTERP ever since and they've worked fine.
And more to your point, they use Numerical Recipes spline routines
which are a cubic spline with natural boundary conditions.
Craig
|
|
|