3rd derivative of position

2 ビュー (過去 30 日間)
sajad
sajad 2014 年 8 月 8 日
回答済み: SHAHZAD 2022 年 10 月 10 日
Hi.
I have question and I will appreciate If you could help me.
I want to calculate the third derivative of position for discrete numbers.
I used the below code for 2nd derivative and I want to know how is the 3rd?
dx = diff(x);dt=diff(t);
v_x = dx./dt;
dt2 = (dt(1:end-1)+dt(2:end))/2;
a_x = diff(v_x)./dt2;
v_x is velocity and a_x is acceleration
thanks

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 8 月 8 日
編集済み: Azzi Abdelmalek 2014 年 8 月 8 日
dt=t(2)-t(1)
dy=gradient(y,dt)
dy2=gradient(dy,dt)
dy3=gradient(dy2,dt)
t=t(1:end-3)
dy3=dy3(1:end-3)
plot(t,dy3)
%or using diff
t=0:0.1:2
y=t.^4
y3=diff(y,3)
dt=diff(t)
dy3=y3./dt(1:end-2)
  2 件のコメント
Erin Browne
Erin Browne 2019 年 3 月 14 日
what would t be equal to?
Torsten
Torsten 2019 年 3 月 15 日
編集済み: Torsten 2019 年 3 月 15 日
t can be any vector of the same length as y with t(i+1) - t(i) = dt = constant for all i.

サインインしてコメントする。


SHAHZAD
SHAHZAD 2022 年 10 月 10 日
v_x = dx./dt;
dt2 = (dt(1:end-1)+dt(2:end))/2;
a_x = diff(v_x)./dt2;

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by