How to plot Multivariable ODE with conditions ?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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)
0 Kommentare
Akzeptierte Antwort
Jan
am 16 Feb. 2022
Bearbeitet: Jan
am 16 Feb. 2022
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!