Simultaneously numerically integrate coupled ODE's in MATLAB

조회 수: 2 (최근 30일)
Ian DSouza
Ian DSouza 2017년 12월 28일
답변: Teja Muppirala 2017년 12월 28일
In MATLAB, I need to numerically integrate two ODE's. Say I have variables time 't', x1(t) and x2(x1).
First differeential equation: contains dervative with respect to x1
Second differeential equation: contains dervative with respect to time 't'
time doesn't explicitly occur in either equation.
But since these are coupled equations, how do I simultaneously integrate at least numerically in MATLAB.
  댓글 수: 2
John D'Errico
John D'Errico 2017년 12월 28일
So the ODEs are not ODEs. This is a system of PDEs.
You can use methods for the solution of PDEs. Entire books have been written on the subject. For example, approximate the derivatives using finite differences. If the system is linear, then the result will be a linear system of equations to then be solved.
Ian DSouza
Ian DSouza 2017년 12월 28일
Not quite. I can boil down the first ODE to "dx2/dx1 = some function of x1 and x2" and the second ODE to "dx1/dt = some other function of x1 and x2". But since x2 is a explicit function of x1 and x1 is an explicit function of t, so this is valid. I don't have to use partial derivatives because my dependent variables (x1 and x2) are explicit functions of at most one variable (with respect to which I am differentiating it). Ideally, this is what I'd like to do. Integrate ODE#1 to tell me how x2 varies with x1. Then integrate ODE#2 to tell me how x1 varies with respect to time. x1 vs. time is what I'm really after. Please let me know if you'd like to see the exact equations if this helps. I can update my question. Thanks.

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

답변 (1개)

Teja Muppirala
Teja Muppirala 2017년 12월 28일
You can get dx2/dt by multiplying dx2/dx1 * dx1/dt.
As a simple example say (I'll use x and y instead of x1 and x2 cause it's easier to see):
dy/dx = x
dx/dt = t
Then the analytic solution (ignoring integration constants) is
x = t^2/2
y = x^2/2 = t^4/8
You can verify that dy/dt = t^3/2 = x*t = dy/dx * dx/dt.
So, the equations you'd put into the ODE solver would be:
dy/dt = x*t
dx/dt = x

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by