# Ode45 with 3 non-linear equations

조회 수: 1(최근 30일)
Ahmed Alagha 2021년 4월 28일
답변: David Goodmanson 2021년 4월 28일
Hello,
I have the following system of 3 diiferential equations.
I am trying to solve it using ode45 in MATLAB but I'm struggling to define the state space variables. This mainly because each equation contains 2 or 3 variable in 2nd derivative form.
How can I deal with this? Any help is appreciated :D

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

### 답변(1개)

David Goodmanson 2021년 4월 28일
Hi Ahmed,
it might be a good idea to go back to the original derivation for this system. Instead of that, you can rewrite this as a matrix equation
[(M+m) m*sin(theta) m*r*cos(theta)] [ y''] [A1]
[ m*sin(theta) m 0 ] [ r''] = [A2]
[ m*cos(thea) 0 m*r ] [theta''] [A3]
where the notation means matrix * column vector = column vector. Each row corresponds to an equation and says that some combination of y'',r'',theta'' equals some other terms. Here A1 is the sum of all the stuff in eqn 1 not involving y'',r'',theta'', taken over to the right hand side. SImilarly for A2 and A3. Each of A1,A2,A3 might involve y,y',r,r',theta,theta'.
For the input to ode45, y,r, and theta are presumed known. Three of the required ode45 equations are
ydot = d/dt y
rdot = d/dt r
so the state variables are effectively known. This means that A1,A2,A3 and the matrix are all known. Denoting the matrix as B, then
[ y''] [A1]
B [ r''] = [A2]
[theta''] [A3]
so
[ y''] [A1]
[ r''] = B \ [A2]
[theta''] [A3]
and the last three required equations are
[ dydot / dt] [A1]
[ drdot / dt] = B \ [A2]

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

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by