How to use ODE solver for a coupled second order ODE?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Are Mjaavatten
2017년 12월 11일
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
참고 항목
카테고리
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!