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)
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!