# How to use ODE solver for a coupled second order ODE?

조회 수: 1 (최근 30일)
Pieter Boersma 2017년 12월 11일
답변: Are Mjaavatten 2017년 12월 11일
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?

댓글을 달려면 로그인하십시오.

### 답변 (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));

댓글을 달려면 로그인하십시오.

### 카테고리

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