Unable to calculate the second derivative of a function
1 回表示 (過去 30 日間)
古いコメントを表示
I want to calculate the second derivative of a function. Below are the steps I am following-
syms a b;
th = sym('th(t)'); %th is a time dependent variable
y = diff(a^2*cos(th)+(b/12)*sin(th));
thd = diff(th); %derivative of th wrt time
ybythd = diff(y,thd); %derivative of y wrt thd
p = diff(ybythd); %derivative of ybythd wrt time
It calculates the following value of p
p = diff(diff((b*cos(th(t))*diff(th(t), t))/12 - a^2*sin(th(t))*diff(th(t), t), t), diff(th(t), t))
I do not see any term of d2th/dt2 in the above result. What is missing?
1 件のコメント
Andriy Kavetsky
2016 年 10 月 6 日
y = diff(a^2*cos(th)+(b/12)*sin(th),th,2) %second derrivative ////////////////////////////////////////// y = diff(a^2*cos(a)+(b/12)*sin(a),a,2) %second derrivative from a and its result
y =
2*cos(a) - 4*a*sin(a) - (b*sin(a))/12 - a^2*cos(a)
回答 (1 件)
Marc Jakobi
2016 年 10 月 6 日
change
th = sym('th(t)'); %th is a time dependent variable
to
th = sym('th'); %th is a time dependent variable
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!