MATLAB Answers

Optimal knot distribution when specifying interpolating value and derivatives

5 views (last 30 days)
belinda suthers
belinda suthers on 13 Feb 2020
Answered: Unai San Miguel on 18 Sep 2020
Hi,
i'm using spapi to build interpolating splines where the y value and its first derivative are specified:
spline1=spapi(knots,5,[x x],[y yprime])
where (x,y) are my interpolating points and (x,yprime) are the first derivative of y at x.
I'd like to use optknt to improve the distribution of the knots in the spline but it requires the interpolating points to non decreasing.
optknt([x x],5,20)
Gives an error whilst
optknt(x,5,20)
Doesnt give the appropriate number of knots for the number of interpolating conditions.
Is there an different method, option or function that can optimise the knot placement in this situation?
With thanks,
Belinda

Answers (1)

Unai San Miguel
Unai San Miguel on 18 Sep 2020
The length of the knot vector knots should be equal to the length of your [x, x] vector plus the order of the spline, 5 in your case, because with spapi you try to solve a determined system, with the same number of equations (length([x, x])) as unknowns (length(knots) - 5). If you want to do oscullatory interpolation with x you need to make up a suitable knot vector. And you can always start with the suggestion from the function, eg spapi(5, [x, x], [y, yprime]), and modify the knot vector from there.

Community Treasure Hunt

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

Start Hunting!