How to use ODE solver for a coupled second order ODE?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have two coupled ODEs that I'm trying to solve with ODE45. They are of the form Ay'' + Bx'' + Cy' + Dy - Esin(x) = 0 and Fx'' + Gy'' + Hx' + Ix - Jsin(x) = 0. How do I get them into a form that can be used by Matlab?
0 comentarios
Respuestas (1)
Are Mjaavatten
el 11 de Dic. de 2017
Convert to four first-order ODEs in x, u,y,v, where u = x', v = y'.
The equations are then:
A*u' + B*v' = -C*v - D^y + E*sin(x)
F*v' + G*u' = -H*u + I^x + J*sin(x)
x' = u
y' = v
If z = [x,y,u,v]', then your function for the right-hand side of the ODE may look something like this:
function dz = rhs(z)
M = [0,0,A,B;0,0,F,G;1,0,0,0;0,1,0,0];
N = [0,D,0,C;I,0,H,0;0,0,1,0;0,0,0,1];
dz = -M\N*z + [E;J;0;0]*sin(z(1));
0 comentarios
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!