How does Matlab know the boudary condition of spline while I did not provide?

2 views (last 30 days)
When I use the spline functions in Matlab, I find most of them don't neeed boundary condition. So, I wondered there must be some way to determine it in Matlab. And I really want to know "How?"
  1 Comment
Andreas Goser
Andreas Goser on 26 Sep 2011
I have just a process, not a real answer, thus putting this as comment. Files like spaps.m and spline.m are written in MATLAB language and thus can be opened in an editor. Maybe you can fnd would you look for in the code.

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 15 Nov 2020
Depending on the specific spline tool used, you can often set the boundary conditions. Spline, for example, allows you to set the end point slopes. However, by default, spline uses what are called the not-a-knot end conditions. That is, spline creates an everywhere twice differentiable function. But at the breaks, the third derivative can have a discontinuity. So spline uses a choice of end conditions where third derivative continuity is enforced at the seconf and penultimate break. Effectivey, that makes those break points not truly breaks.
Other splines allow different sets of boundary conditions if you choose to use them. Thus you can create natural cubic splines if you wish.
Finally, some tools like pchip, are not truly splines. They don't really need to use boundary conditions as you describe.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!