HOW TO SOLVE 2 EQUATION ODE USING ODE45 IN MATLAB?

조회 수: 1 (최근 30일)
emyleana adnan
emyleana adnan 2021년 6월 7일
답변: Stephan 2021년 6월 8일
My equation is
I need to solve it by using ODE45. I dont know how to put in my matlab coding since it have 2 equation.
Thanks in advance for your help.
  댓글 수: 2
James Tursa
James Tursa 2021년 6월 7일
What have you tried so far? What specific problems are you having with your code? Have you looked at the examples in the ode45 doc for how to handle multiple equations?
emyleana adnan
emyleana adnan 2021년 6월 8일
This is what i have tried so far. It show me alot of error.
clear
clc
f = @(t,y) [y(1); 0.303*y(1)-0.557*y(1)^2+0.260*y(2)*y(1); y(2); 0.0345*y(2)-(1.18*(10^(-7))*y(2)^2)+(3.55*(10^(-14))*y(1)*y(2))];
y(1) = 0.0718;
y(2) = 0.225;
Y0 = [0.0718,0.225];
tspan = [0 5];
[T,Y] = ode45(f,tspan,Y0);
This is error that it state

댓글을 달려면 로그인하십시오.

답변 (1개)

Stephan
Stephan 2021년 6월 8일
f = @(t,y) [0.303*y(1)-0.557*y(1).^2+0.260*y(2).*y(1);...
0.0345*y(2)-1.18e-7*y(2).^2+3.55e-14*y(1).*y(2)];
Y0 = [0.0718,0.225];
tspan = [0 5];
[T,Y] = ode45(f,tspan,Y0);
plot(T,Y)

카테고리

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