how to use ode45 with 4 ode?

2 次查看(过去 30 天)
Shani Gal
Shani Gal 2017-1-14
Hi
I have a set of 4 ode, How can I use ode45 to solve them?
The ode:
dr/dt=u
d(TH)/dt=h/r^2
du/dt=h^2/r^3-1/r^2+a(t)*sin(phi)
dh/dt=r*a(t)*cos(phi)
I also know:
h=r^2*d(TH)/dt
a(t)=ASS/(BSS*t)
phi=phi1+atan(r*u/h)
( ASS, BSS, phi1 are constant)
( the variables are: r TH u h phi a(t) and t is the time )
Thank you
Shani

回答(1 个)

John D'Errico
John D'Errico 2017-1-14
Did you try it? Did you read the help for ODE45? There are examples in there.
You need to spend some time thinking about this problem.
You state that: "I also know:
h=r^2*d(TH)/dt
a(t)=ASS/(BSS*t)
phi=phi1+atan(r*u/h)
The first one is merely a restatement of one of the ODEs. So it is not relevant.
The second equation is just a reflection that a(t) is NOT an unknown. It is a linear function of t. So calling a(t) an unknown is silly.
Finally, the third equation is merely a relation between the other unknowns. So, given values for {phi1,r,u,h}, you can just replace phi anywhere you see it with that relation. So phi is also not an unknown in context of a differential equation solution.
That means you have 4 ODEs, with 4 variables to solve for: {r,TH,u,h}. Compute phi afterwards if you need it as a variable. But at that point, you have the values for all other variables at any time step.
Again, just read the doc for ODE45. Look at the examples in there, then just follow what you see.

类别

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