# Cubic Spline

Printable View

• Dec 9th 2007, 01:28 AM
Atomic_Sheep
Cubic Spline
I've got a few questions related to fitting cubic splines to data.

1.) how is it done? I know you can do it in matlab but how is it done in matlab? In other words i'm interested in how matlab as a program does it and not the process of doing them in matlab as you would find in the matlab manual.

2.) what is the implication of having 2 or 3 or more points in your data that are on the same level... how does a cubic spline fit over those?
• Dec 9th 2007, 08:36 AM
topsquark
Quote:

Originally Posted by Atomic_Sheep
I've got a few questions related to fitting cubic splines to data.

1.) how is it done? I know you can do it in matlab but how is it done in matlab? In other words i'm interested in how matlab as a program does it and not the process of doing them in matlab as you would find in the matlab manual.

2.) what is the implication of having 2 or 3 or more points in your data that are on the same level... how does a cubic spline fit over those?

Here's a brief explanation of how it's done in general. Mathlab might have a few numerical algorithms embedded in it to make the solution easier for it.

-Dan
• Dec 14th 2007, 06:07 PM
DavidB
Wikipedia is usually a good starting point too:

Spline interpolation - Wikipedia, the free encyclopedia
• Dec 24th 2007, 11:33 AM
Isomorphism
Quote:

Originally Posted by Atomic_Sheep
I've got a few questions related to fitting cubic splines to data.

1.) how is it done? I know you can do it in matlab but how is it done in matlab? In other words i'm interested in how matlab as a program does it and not the process of doing them in matlab as you would find in the matlab manual.

2.) what is the implication of having 2 or 3 or more points in your data that are on the same level... how does a cubic spline fit over those?

Are you still on it? Do you still have doubts with it?
I wrote a spline function that imitates MATLAB's not too long ago.
You can check the mathworks site, goto cleve moler's page. He has fully described the cubic splines in a neat way.
I believe MATLAB uses both clamped and Natural as inputs.
• Dec 25th 2007, 11:04 PM
Atomic_Sheep
Quote:

Originally Posted by Isomorphism
Are you still on it? Do you still have doubts with it?
I wrote a spline function that imitates MATLAB's not too long ago.
You can check the mathworks site, goto cleve moler's page. He has fully described the cubic splines in a neat way.
I believe MATLAB uses both clamped and Natural as inputs.

No not really on it at the moment with christmas and new years and all that... in a different city at the moment... had a quick look though and looks interesting will surely give it a closer inspection when I get home thanks for the link and have a happy new year.
• Dec 26th 2007, 12:02 AM
CaptainBlack
Quote:

Originally Posted by Isomorphism
Are you still on it? Do you still have doubts with it?
I wrote a spline function that imitates MATLAB's not too long ago.
You can check the mathworks site, goto cleve moler's page. He has fully described the cubic splines in a neat way.
I believe MATLAB uses both clamped and Natural as inputs.

It is generaly usefull to give a link or the URL when refering to something
on the net.

Also Cleve's book Numerical Computing with MATLAB is available on
line at:

The MathWorks - Numerical Computing with MATLAB by Cleve Moler

and the chaper relevant to this question at:

Chapter 3 Interpolation

RonL
• Dec 26th 2007, 04:45 AM
Isomorphism
Quote:

Originally Posted by CaptainBlack
It is generaly usefull to give a link or the URL when refering to something on the net.

I generally do, but I was not sure if the poster wanted it(since the thread was old) and I was in a hurry that day :)
• Jan 27th 2010, 07:40 AM
rayMat
Matlab equivalent cubic spline
Isomorphism,

Were you able to immitate the Matlab implementation in c/c++? or did you follow the book 'A practical guide to Splines' to come up with the implementation?

I have a need in my project to develop c++ equivalent of Matlab cubic spline functionality. I don't have the book right now, but I'm trying to judge what is the best route I should take!

Has anyone else had the experience in implementing the cubic spline functionality?

Thanks

Quote:

Originally Posted by Isomorphism
Are you still on it? Do you still have doubts with it?
I wrote a spline function that imitates MATLAB's not too long ago.
You can check the mathworks site, goto cleve moler's page. He has fully described the cubic splines in a neat way.
I believe MATLAB uses both clamped and Natural as inputs.

• Jan 29th 2010, 08:07 PM
Atomic_Sheep
Not quite sure, whether we are on the same page but I found some good resources out there demonstrating various spline methods that I think are easy enough to code in C++. I think you will be able to find code for it already done and publicly available if you look around anyway.