plotting the solutions of a differential system with numerical ways

2 次查看(过去 30 天)
Hi, i'm trying to plot the solutions of a differential system with a numerical method, i don't know how to do this, does anyone know how to do in matlab with an example ?
This is my system:
dx/dt=((3x+2)/(5y+x)) +3*x dy/dt=3*x*y-5y
Thanks you very much !!!

采纳的回答

Mischa Kim
Mischa Kim 2015-5-6
Yep, take a look:
function my_EOM()
IC = [-1 -1];
[t,qsol] = ode45(@EOM,[0 1],IC);
plot(t,qsol)
xlabel('t')
ylabel('x, y')
grid
end
function dqdt = EOM(~,q)
x = q(1);
y = q(2);
dqdt = [((3*x + 2)/(5*y + x)) + 3*x; ...
3*x*y - 5*y];
end

更多回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2015-5-6
start_time=0
final_time=10
in=[1 ;0]; %initials conditions
[t,y] = ode45(@myfcn,[start_time final_time],in);
plot(t,y)
Where myfcn is a function
function dy=myfcn(t,y)
dy=zeros(2,1)
dy(1)=(3*y(1)+2)/(5*y(2)+y(1))+3*y(1)
dy(2)=3*y(1)*y(2)-5*y(1)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by