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 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