How do I solve higher order multi-variable ODE systems in MATLAB

I have 2 governing equations for my reactions and they are a factor of 4 different variables. How do I use a nested function to solve it.
ds/dt=(d^2s)/dx^2 - ds/dx- s
dq/dt=-∝.s
Subject to below initial & boundary conditions are
t=0,s=0;
x=0,s=1;
x=1,ds/dx=0;
t=0,q=0;
This is part of the bigger set of equations but I'm not sure how to include s, t, q and x in there. All I've worked with before has been everything in terms of changes over time, but here it's time and distance (x). s and q are concentration of two solvents. Beta, gamma and alpha are all constants.

 채택된 답변

Torsten
Torsten 2016년 4월 27일
편집: Torsten 2016년 4월 27일

1 개 추천

The first equation is a partial differential equation. Since it is independent of q, you can solve it using MATLAB's "pdepe". After you've done this, you can use the results to get q using a solver for ordinary differential equations (e.g. ODE15S). But my guess is that you forgot to include a coupling term between the two equations (i.e. s dependent on q) which will make things more difficult.
Best wishes
Torsten.

댓글 수: 2

Thanks Torsten. I think what you suggested is the way to go about this. I assume I have to make two functions and call on function one to solve the dq/dt. I don't think I've missed any connecting equations between s and q.
Torsten,
When you say "you can use the results to get q using a solver for ordinary differential equations (e.g. ODE15S)." can you give an example of how to recall the results from a pdepe in a ode function??
Thanks,

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

추가 답변 (0개)

카테고리

질문:

2016년 4월 26일

댓글:

2016년 5월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by