Solving a non-linear second order ODE with Matlab

조회 수: 8 (최근 30일)
Whitewater
Whitewater 2015년 4월 29일
댓글: Jan 2015년 4월 30일
I am brand new to Matlab, but I have to find an approximate numerical solution to the following differential equation:
d^2p/dr^2+dp/dr*1/r-2*exp(m(r))*sinh(p)=0 OR p''+p'*(1/r)-2*exp(m(r))*sinh(p)=0
I have separated it (I think correctly??) into two first order ODEs:
y0'=y1 y1'=2*exp(m(r))*sinh(y1)
Now I am confused on how to input this into Matlab. Any help is greatly appreciated!

채택된 답변

Torsten
Torsten 2015년 4월 29일
Use UDE45 if your problem is an initial value Problem, use bvp4c if it is a boundary value problem.
Best wishes
Torsten.
  댓글 수: 3
Torsten
Torsten 2015년 4월 30일
And your system of equations must read
y0'=y1
y1'=-y1/r+2*exp(m(r))*sinh(y0)
Best wishes
Torsten.
Jan
Jan 2015년 4월 30일
@Torsten: You know that you can edit your messages?

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

추가 답변 (2개)

Pratik Bajaria
Pratik Bajaria 2015년 4월 29일
Hello,
ode45 must work for you. All you have to do is make a function handle, which carries your ode function that you have split into set of first order differential equations and then use ode45 solver in MATLAB to attain a solution.
Similar to example shown on this URL: ODE45
Hope it helps!
Regards, Pratik

Bjorn Gustavsson
Bjorn Gustavsson 2015년 4월 29일
Another pointer...
You have in fact not separated your DE correctly. You get y1' directly from your DE if you change dp/dr with y1.
HTH

카테고리

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