how to take the derivative for the retained value from ode45?

조회 수: 8 (최근 30일)
Nawal
Nawal 2013년 7월 31일
I'm using the ode45 to find the velocity, now I need to find the acceleration how can I take the derivative of the retained value.
My ode45 is:
[ts,xs]= ode45(@my_function,[0,10],[5,0])
Thanks in advance!

답변 (2개)

Walter Roberson
Walter Roberson 2013년 7월 31일
gradient(xs(1,:), ts(:))
  댓글 수: 6
Richard Brown
Richard Brown 2013년 8월 1일
I stand corrected, good to know!
Jan
Jan 2013년 8월 1일
gradient uses a first order method when the spacing is not equidistant. You can use the faster method FEX: DGradient and some other equivalent tools from the FEX, which apply a 2nd order method to get more accurate results for the derivatives.

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


Nawal
Nawal 2013년 8월 1일
Can I do something like
diff [ts,xs]

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by