converting a second degree differential equation into a first order

9 ビュー (過去 30 日間)
Anas Gharsa
Anas Gharsa 2022 年 1 月 28 日
コメント済み: Star Strider 2022 年 1 月 28 日
I am trying to reduce the order of a function but I always get an error message :
syms y(t);
eqn = diff(y,2) + c*y' + k*y == F0sin(w*t) ;
cond1 = y(0) == 4 ;
cond2 diff(y0) == 0 ;
V = odeToVectorField(eqn);

採用された回答

Star Strider
Star Strider 2022 年 1 月 28 日
Declare all the variables, and for good measure, return the second output from odeToVectorField because it tells you wnat the function is doing internally, and the substitutions it made.
syms c k F0 w y(t)
D1y = diff(y);
D2y = diff(D1y);
eqn = D2y + c*D1y + k*y == F0*sin(w*t) ;
% cond1 = y(0) == 4 ;
% cond2 = diff(y0) == 0 ;
[V,Subs] = odeToVectorField(eqn)
V = 
Subs = 
Now, convert this into an anonymous function that the nmumerical ordinary differntial equation solvers can work with, and integrate it to get a numerical result.
.
.
  6 件のコメント
Anas Gharsa
Anas Gharsa 2022 年 1 月 28 日
Thank you again for your help!!! I really appreciate it
Star Strider
Star Strider 2022 年 1 月 28 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by