필터 지우기
필터 지우기

plotting the solutions of a differential system with numerical ways

조회 수: 2 (최근 30일)
abc abc
abc abc 2015년 5월 6일
댓글: abc abc 2015년 5월 8일
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