How to plot Multivariable ODE with conditions ?

1 回表示 (過去 30 日間)
Mujtaba Farrukh
Mujtaba Farrukh 2022 年 2 月 16 日
編集済み: Jan 2022 年 2 月 16 日
Hi everyone,
I have been trying to plot this, but no luck. Can anyone help me out to do this.
I have attached the code, please do have a look. If theres any alternative then do let me know. I will appreciate that:
syms x(t) y(t) z(t)
% t=0:0.1:100;
ode1 = diff(x) == y-x;
ode2 = diff(y) == -x*z;
ode3 = diff(z) == x*y-2.2;
cond1 = x(0) == 1;
cond2 = y(0) == 0;
cond3 = z(0) == 0;
sol1 = dsolve(ode1,cond1) % x(t)
sol2 = dsolve(ode2,cond2) % y(t)
sol3 = dsolve(ode3,cond3) % z(t)

採用された回答

Jan
Jan 2022 年 2 月 16 日
編集済み: Jan 2022 年 2 月 16 日
You are asked to do this in Simulink, not in Matlab.
In Matlab a numerical solution is a better idea than hoping, that there is a closed form symbolical solution. Remember that most functions do not have a closed form integral. A numerical solution:
a = 2.2;
F = @(t, x) [x(2) - x(1); ...
-x(1) * x(3); ...
x(1) * x(2) - a];
[t, x] = ode45(F, [0 100], [1, 0, 0]);
plot(t, x)

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by