How to solve coupled first order ODE using something other than ODE45?
2 次查看(过去 30 天)
显示 更早的评论
I have 6 coupled equations:
- m1'=-m1+a/(1+p3)^n+a0
- m2'=-m2+a/(1+p1)^n+a0
- m3'=-m3+a/(1+p2)^n+a0
- p1'=-b(p1-m1)
- p2'=-b(p2-m2)
- p3'=-b(p3-m3)
{a, a0, b and n are parameters. m1' is showing derivative of m1 with respect to t (time).}
I know these equations can easily be solved using ODE45 but I want to solve them using something more basic like Euler method. I can solve uncoupled ODEs using Euler method but for coupled equation I am little confused. Someone please give me or give me some ideas and hints to solve these equations. Thank you.
0 个评论
回答(1 个)
John D'Errico
2017-4-22
编辑:John D'Errico
2017-4-22
What is the problem? If you understand how to solve an ODE using Euler's method, all you need to do is use the current value of your variables to predict ahead. If you have two or more variables, it still works the same. WTP?
Thus, if you have
y' = f(t,y)
then you predict ahead at time step t(k) to step t(k+1) as:
y(k+1) = y(k) + f(t(k),y(k))*dt
If you have multiple coupled equations, then each of them is still of the same form. Euler's method is about as simple as you can make it. It is not very good, since it is just Euler's method! But then, you are the one who wants to use it instead of something better. (This is rarely a good idea, unless you know enough to fully understand the problems and how to recognize them, as well as to know if you can afford to use a poor method. If you can't figure out how to code Euler's method, then you don't understand the issues.)
2 个评论
shireesha myadari
2021-2-25
I am not understanding ,how to make coupling between the given equations.
Thanks in advance.
另请参阅
类别
在 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!