Solve ode system numerically
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello, I'm trying to repeat one of model in a scientifc paper. Is there are any method using ode45 to solve following eqns same time.
Thank you so much.

댓글 수: 2
David Goodmanson
2021년 10월 29일
Hello ZY,
are A,Dplus and Dminus scalar constants, or are any of them functions of x?
답변 (2개)
John D'Errico
2021년 11월 3일
편집: John D'Errico
2021년 11월 3일
Not that hard. As @William Rose sugggests, the mass matrix solves it, but you need to look carefully at the problem.
J is given as a function of the other derivatives. But J appears only in the other equations in a simple form. So, substitute into equations 1 and 2 for J. Now, move all the derivative terms to the left hand side. Collect terms. I won't do the work for you, because the notation is nasty to write. (The symbolic TB should help in this if you want, but it is just basic algebra.) And anyway, you don't give the constants, so I cannot show the solution as an example.
In the end, you will have a mass matrix for a TWO equation system, in TWO variables, C and phi. So the mass matrix will be 2x2, a function of the variables, but that is not a problem. You have two initial values at x==0, so ODE45 should have no problem, unless there is a singularity in the mass matrix. I'd worry about that when there is a reason to worry. A singularity should arise only if A == 2*C(x), so you might watch for that case. Regardless, that was going to kill you in any event.
Once you have solved for C(x) and phi(x), then you can recover J(x).
As I said, not difficult.
댓글 수: 0
William Rose
2021년 11월 2일
This is a good question. I thought it could be done with ode45, by using the mass matrix option. This appears to be exactly the kind of problem the mass matrix option is supposed to solve. See the online help here: Choosing an ODE solver, and here: solve baton ODEs. But see the issue below.
The attached code demonstrates the use of the mass matrix for this problem.
The code runs, but the results are mostly NaNs, because the mass matrix is not invertible. It is not invertible because of the structure of the problem.
M = [1 0 0
0 1 0
-Dp -Dp*C 0]
The mass matrix above is obviously singular.
I suspect there is a way to do this with ode45() which should be obvious - but I don't see it.
댓글 수: 2
William Rose
2021년 11월 3일
편집: William Rose
2021년 11월 3일
The equations in the figure can be simplified to a pair of linear equations for
and for
. I was encouraged when I realized this, because I thought I would solve the system of equations to obtain a solution that could be used in ode45(). However, the right hand side of the system is zero, so the only solution is when
=
=J=0, for all values of x. This is not very interesting. See attached. Check my work, in case I made a mistake.
Other questions and notes:
- Please provide the citation for the scientific paper which was the source of the equations.
- What are the initial values for C and φ and J?
- I assume the asterisk in the equation for
represents simple multiplication. - The equation for
can be simplified by eliminating
from the numerator and denominator.
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!