substitute only first derivative in symbolic toolbox

6 ビュー (過去 30 日間)
Antonio d'Aniello
Antonio d'Aniello 2020 年 10 月 12 日
コメント済み: Antonio d'Aniello 2020 年 10 月 12 日
I am considering a second order differential equation (mass - spring system), and I want to substitute the first derivative with another symbolic function.
syms x(t) v(t) m k
expr = m * diff(x, t, 2) + k * x(t) == 0;
expr2 = subs(expr, diff(x, t, 1), v(t));
Anyway, result of expr2 still containts the second derivative of x(t) and not the first derivative of v(t). Is there a way I can solve it and make it explicit?
>> expr2
expr2(t) =
m*diff(x(t), t, t) + k*x(t) == 0
  1 件のコメント
VBBV
VBBV 2020 年 10 月 12 日
編集済み: VBBV 2020 年 10 月 12 日
Try this
%f true
% code
%end
syms x(t) v(t) m k
expr = m * diff(x, t, 2) + k * x(t) == 0;
expr2 = subs(expr, diff(x, t, 2), diff(v,t,1)); % the old is diff(x,t,2)

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

採用された回答

madhan ravi
madhan ravi 2020 年 10 月 12 日
I remember doing vibration analysis, used to be pretty tricky:
expr2 = subs(expr, diff(x, 2), diff(v))
  1 件のコメント
Antonio d'Aniello
Antonio d'Aniello 2020 年 10 月 12 日
well honestly I didn't think about that. Thank you so much!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by