I have 9 coupled nonlinear ordinary differential equations. and i have to convert it in to state space form. here i have 9 state variable including theta.
3 views (last 30 days)
Show older comments

0 Comments
Accepted Answer
Torsten
on 17 Jul 2025
Edited: Torsten
on 17 Jul 2025
Write your system as
M(U,U')*U'' = f(U,U')
with a (9x9) matrix M.
Then you can use ode15s to solve the system
V' = W
M(V,W)*W' = f(V,W)
or
[I , 0 ; 0 M] * [V' ; W'] = [W ; f(V,W)]
with V = U, W = U' and the mass matrix [I , 0 ; 0 M] (I = identity matrix, 0 = null matrix, both of size (9x9)).
2 Comments
Torsten
on 17 Jul 2025
If you order your second-order derivatives as a vector [u1'' u2'' u3'' u4'' phi1'' phi2'' phi3'' phi4'' theta''].', your matrix M and vector f would be (if iI'm not mistaken):
M = [m11 m13 0 0 m12 m14 0 0 0;...
m21 m23 0 0 m22 m24 0 0 0;...
m31 m33 m35 0 m32 0 m36 0 0;...
m41 0 m45 0 m42 m44 m46 0 0;...
0 m53 m55 m57 0 m54 0 m58 0;...
0 m63 m66 m67 0 m64 0 m68 0; ...
0 0 m75 m77 0 0 m76 m78 -me*sin(theta);...
0 0 m85 m87 0 0 m86 m88 0;...
0 0 0 -me*sin(theta) 0 0 0 0 me^2+I_p];
f = -[Z1; Z2; Z3; Z4; Z5; Z6; Z7-me*theta_dot^2*cos(theta); Z8; Z9-tau];
More Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!