Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

c/c++ equivalent of Matlab cubic spline

293 views
Skip to first unread message

Andy

unread,
Jan 27, 2010, 2:13:05 PM1/27/10
to
Hi,

Has anyone tried to build c or c++ code for the Matlab cubic spline equivalent functionality (interp1 or spline). We have a need to match the Matlab output for cubic spline interpolation. The Matlab algo is derived from 'A practical guide to splines' book from deBoor C., which I don't have currently.

Should the approach be looking at the Matlab code and trying to imitate on c++ side, or follow the book, or another source I found was 'Numerical Recipes'. Any experience or pointer to which one is the best approach?

Thanks,
Andy

Heinrich Dover

unread,
Jan 28, 2010, 12:48:59 AM1/28/10
to


As far as I remember (and I'm not verifying this at the moment), all
code from de Boor's book is in fortran. And available on his webpage.
Those are simple routines (from a programmer's point of view), and
shouldn't be that hard to translate to c.

best regards,
Heinrich

Walter Roberson

unread,
Jan 28, 2010, 3:42:25 PM1/28/10
to
Heinrich Dover wrote:

> As far as I remember (and I'm not verifying this at the moment), all
> code from de Boor's book is in fortran. And available on his webpage.
> Those are simple routines (from a programmer's point of view), and
> shouldn't be that hard to translate to c.

There is also "Numerical Recipes in C".

NB: some people have indicated to me that both versions have bugs, more so in
the C version. I haven't looked at the code myself, so I do not know this to
be true.

Andy

unread,
Jan 29, 2010, 2:00:22 PM1/29/10
to
Thanks folks for your posts. I ended up in implementing the algorithm from Numerical Recipes. It may not be as robust and accurate as Matlab's implementation, but for the data set I am looking at, the difference shows up after 3rd decimal digit - which is fair enough for the application.

- Andy

Walter Roberson <robe...@hushmail.com> wrote in message <hjst9k$2ej$1...@canopus.cc.umanitoba.ca>...

0 new messages