How do I solve coupled ordinary differential equations with boundary conditions?

조회 수: 2 (최근 30일)
I have four coupled ODE's. I am not sure how to plot and solve them using Matlab. The equations are: dy(1)=y(2); dy(2)=10*((50000*y(1)*exp(-10/y(3)))+y(2)); dy(3)=y(4); dy(4)=10*((-100000*y(1)*exp(-10/y(3)))+y(4)); with following boundary conditions: y1(0) = 1, y3(0) = 0, y2(2) = 0, y4(2) = 0 I think they can be solved numerically, but I'm not sure how. can anyone help me with my problem? tnx

답변 (1개)

Torsten
Torsten 2015년 8월 10일
편집: Torsten 2015년 8월 11일
function mat4bvp
solinit = bvpinit(linspace(0,2,10),[1 0 1e-5 0]);
sol = bvp4c(@mat4ode,@mat4bc,solinit);
x = linspace(0,2);
y = deval(sol,x);
plot(x,y(1,:),x,y(2,:),x,y(3,:),x,y(4,:))
% ------------------------------------------------------------
function dydx = mat4ode(x,y)
dydx = [ y(2)
10*(50000*y(1)*exp(-10/y(3))+y(2))
y(4)
10*(-100000*y(1)*exp(-10/y(3))+y(4)) ];
% ------------------------------------------------------------
function res = mat4bc(ya,yb)
res = [ ya(1)-1
yb(2)
ya(3)
yb(4) ];
% ------------------------------------------------------------
Best wishes
Torsten.
  댓글 수: 1
kyana shayan
kyana shayan 2015년 8월 16일
thank you for your time Torsten, but I don't get it. should I open 3 scripts, and put the functions in each? can you tell me how this code works?

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

카테고리

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