Solving a ODE in matlab

3 ビュー (過去 30 日間)
Antonio Buo
Antonio Buo 2019 年 8 月 21 日
回答済み: Stephan 2019 年 8 月 21 日
I'm tryng to solve this ODE with ode45:
can someone explain how to do this?
Here is what i tried
t=0:0.005:8;
ode = diff(y) == y^2-y*0.1*cos(2*t)-0.2*cos(2*t);
y0 = -1;
[t,y] = ode45(ode,t,y0);

採用された回答

Stephan
Stephan 2019 年 8 月 21 日
ode = @(t,y) y.^2-y.*0.1*cos(2.*t)-0.2*cos(2.*t);
t=[0 8];
y0 = -1;
[t,y] = ode45(ode,t,y0);
plot(t,y)

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by