How to plot Multivariable ODE with conditions ?

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by