HOW TO SOLVE 2 EQUATION ODE USING ODE45 IN MATLAB?

2 views (last 30 days)
emyleana adnan on 7 Jun 2021
Answered: Stephan on 8 Jun 2021
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.
emyleana adnan on 8 Jun 2021
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

Stephan on 8 Jun 2021
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)

Categories

Find more on Ordinary Differential Equations in Help Center and File Exchange

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by