How to solve coupled first order ODE using something other than ODE45?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
John D'Errico
el 22 de Abr. de 2017
Editada: John D'Errico
el 22 de Abr. de 2017
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 comentarios
Luqman Saleem
el 22 de Abr. de 2017
Editada: Luqman Saleem
el 22 de Abr. de 2017
shireesha myadari
el 25 de Feb. de 2021
I am not understanding ,how to make coupling between the given equations.
Thanks in advance.
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!