필터 지우기
필터 지우기

How to differentiate a cubic spline

조회 수: 1 (최근 30일)
MeEngr
MeEngr 2015년 2월 10일
댓글: MeEngr 2015년 2월 10일
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.

답변 (1개)

John D'Errico
John D'Errico 2015년 2월 10일
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
MeEngr
MeEngr 2015년 2월 10일
Thanks, John. I'm sorry, but I'm still confused.
What exactly are we achieving using these two commands and how do I plot the velocity? I'm trying to look this up online and in Matlab's documentation but I'm not getting anything.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Splines에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by