File Exchange

image thumbnail

MATLAB simulation of fixed-mass rigid-body 6DOF

version (2.08 KB) by

Calculate aircraft fixed-mass rigid-body six-degrees-of-freedom equations of motion using MATLAB ODE

20 Ratings



View License

% SIXDOF Calculate aircraft fixed-mass rigid-body six-degrees-of-freedom
% equations of motion using MATLAB ODE45 solver.
% =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
% Inputs:
% =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
% Forces = 3x1 vector of forces in body coordinates
% Moments = 3x1 vectory of moments in body coordinates
% Mass = fixed mass of the aircraft
% Inertia = 3x3 Inertia Tensor matrix
% tarray = time series vector
% Ipos_i = 3x1 vector of initial position
% Ivel_b = 3x1 vector of initial velocity (body)
% Irates_b = 3x1 vector of initial body rates
% Ieuler = 3x1 vector of initial euler angles
% =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
% Outputs:
% =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
% t = simulation time
% y(1:3) = body rates
% y(4:6) = velocity in body coordinates
% y(7:9) = position in body coordinates

Comments and Ratings (20)

Joao Santos

Note: the equation for the body-frame position is wrong.

dr/dt = v is only valid in a inertial frame, not on a rotating frame.

The right equation is

dr/dt = v - (omega)x(r), where x is the cross product between 2 vectors.

Then, the code is

y(4:6) - cross(y(1:3), y(7:9))

The rotation part works perfectly though, thanks



There is little reason for this *single* file to be highly rated. Errors as mentioned previously Mar 2008 have NOT been corrected.

The author apparently wants to play with the new custom toolbox toy. Nothing else here.


Marine (view profile)

Edmund Brekke

The Euler angles should have been included in the output.

Hello everyone!
That's a very good program!
Can anybody help me to get as an output the euler angles value...?
What should I supplement?
I tried something but unfortunately i didn't get the presumed result.


spika spika


Great file, great help for people (like me) who are looking for software to simulate unconstrained motion of a rigid body. Quick comment: the code has a small bug...

In line 86:
Ipos_i = dcm*Ipos_i; % 3-by-3 by 1-by-3

Can be simply changed to:
Ipos_i = dcm*Ipos_i'; % 3-by-3 by 1-by-3
Ipos_i = Ipos_i';

Or something fancier. In any case, this is a great piece of code, and it is rather self-explanatory so disregard other reviews asking to make comments in the code.

In my humble opinion, if the derivation is unclear, one should write out (by hand) the equations to get a clearer picture. There are also short tutorials on the subject available (e.g., search for SIGGRAPH '97 unconstrained motion).

Sum Yew Kong

Very Good matlab function, especially for undergraduates to understand 6dof concept and to use this for case study simulation.

manoj choudhary

Asen Marinov

ian lang

very good.

ery irianto

hebat dong.
aku minta simulasi dinamik yang lain ya!

Arthur Sugiharto

This is a very best simulation i ever found... hehehe...

bensahaila hocine

je suis hocine ,je cherche des documents sur la simmulatuin avec maleb et qui concerne les signaux aléatoires (domaine des telecommunication).
je vous remirci.

xenia hernandez

raghu reddy

Randall Hudson

The code looks good. I would increase the rating to five if the code included more details in the description.

Randall Hudson

This is my first download. I hope the description is an accurate description of the application. I am assuming the download includes the code. Not knowing exactly what I am getting is why I rated this 3. I will know more when I download the file.

li li


Updated license


update to MATLAB Toolbox File format

MATLAB Release
MATLAB 6.5 (R13)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video