How to solve this system using ODE45?

8 ビュー (過去 30 日間)
Seungman Kim
Seungman Kim 2017 年 3 月 24 日
コメント済み: Steven Lord 2020 年 1 月 25 日
The ODE system
dx/dt = -8/3 x + yz;
dy/dt = -10y + 10z;
dz/dt = -x*y + 28y - z when t=[0,50]
I only learned how to solve one equation each but,
I wanna solve this system using ODE45 on matlab
please help me how to make the script.

採用された回答

Star Strider
Star Strider 2017 年 3 月 24 日
You first must assign ‘x’, ‘y’, and ‘z’ to a vector, then create the appropriate first-order differential equations with respect to each variable.
Example:
% % % MAPPING: x = v(1), y = v(2), z = v(3)
% dv(1,:) = -8/3.*v(1) + v(2).*v(3);
% dv(2,:) = -10*v(2) + 10*v(3);
% dv(3,:) = -v(1).*v(2) + 28*v(2) - v(3);
v_fcn = @(t,v) [-8/3.*v(1) + v(2).*v(3); -10*v(2) + 10*v(3); -v(1).*v(2) + 28*v(2) - v(3)];
ts = [0 50];
init_cond = [10; 10; 10];
[T,V] = ode45(v_fcn, ts, init_cond);
figure(1)
plot(T,V)
grid
I used an anonymous function here, simply for convenience. See the section on ‘Anonymous Functions’ in Function Basics for details on how to write them and use them.

その他の回答 (1 件)

Sameer kumar nayak
Sameer kumar nayak 2020 年 1 月 25 日
7d²x/dt²+3dx/dt+5x+6=0 how can we solve using matlab using ode45??
  1 件のコメント
Steven Lord
Steven Lord 2020 年 1 月 25 日
See the "Nonstiff van der Pol Equation" example on this documentation page. You should be able to use the same techniques as that example to solve your ODE.

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

カテゴリ

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