How to differentiate a cubic spline
Mostrar comentarios más antiguos
Hi all.
I'm plotting the position of a particle vs time using a cubic spline as follows:
xx = csapi(t, pos);
fnplt(xx);
Here, t and pos are both vectors.
I now need to plot the velocity vs time for this particle. My question is, how do I differentiate a cubic spline? Any help would be appreciated.
Respuestas (1)
John D'Errico
el 10 de Feb. de 2015
Simple enough to do by differentiating each polynomial segment.
That is, if we have
pp = csapi(t,pos);
Then for a cubic spline in pp form, this will suffice:
ppd = pp;
ppd.coefs = ppd.coefs*diag([3 2 1],1);
1 comentario
MeEngr
el 10 de Feb. de 2015
Categorías
Más información sobre Splines en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!