# how to solve 3dof point mass equations of motion of flight vehicle

10 views (last 30 days)
sanket neharkar on 13 Jun 2022
Answered: Bjorn Gustavsson on 13 Jun 2022
i have to solve 6 differential equations of 3dof system of flight vehicle abd plot them. i have run a code but i am not getting appropriate results.
plzz anyone help me how to do that.
clear all;close all;clc;
t = 0:0.1:15;
y0= [0.5 0.5 0.5 0.5 0.5 0.5];
[tsol ysol] = ode45(@threedof, t, y0);
velocity = ysol(:,1);
yaw_angle = ysol(:,2);
pitch_angle = ysol(:,3);
x = ysol(:,4);
y = ysol(:,5);
z = ysol(:,6);
figure();
plot(tsol,velocity,'or',tsol,yaw_angle,'--k',tsol,pitch_angle,'--b',tsol,x,'oy',tsol,y,'ok',tsol,z,'og')
function solveode = threedof(t,y);
T = 2000; m = 200; g = 9.81; gamma = 10*pi/180; V=100; phi = (10*pi/180); %Vvec= [V;0;0];
D = 00; S=00; L = 0000;
fval(1)=((T/m)-(D/m)-(g*sin(gamma)));
fval(2)=((L/m*V)-(g*cos(gamma)/V));
favl(3)=(S/(m*V*cos(gamma)));
fval(4)=V*cos(gamma)*cos(phi);
fval(5)=V*cos(gamma)*sin(phi);
fval(6)=V*sin(gamma);
solveode = [fval(1);fval(2);favl(3);fval(4);fval(5);fval(6)];
end
Sam Chak on 13 Jun 2022
Hi Flight engineer,
What are the expected appropriate results?
Notice that your pitch angle is flying at 0.5 rad, where 1 rad is approx 57.3°. The aircraft is not going to stall?

Bjorn Gustavsson on 13 Jun 2022
A three-degrees-of-freedom dynamic system in three spatial coordinates doesn't have yaw and pitch degrees of freedom. It is effectively modeling the trajectory of a particle. As such your ODE-function looks dodgy. My standard way of writing equations-of-motion are, something like:
function d2ydt2dydt = threedof(t,y)
T = 2000; % describe units...
m = 200;
g = 9.81;
gamma = 10*pi/180;
phi = (10*pi/180); %Vvec= [V;0;0];
D = 0; % Drag?
S = 0; % Some other parameter?
L = 0; % Lift
V = y(1:3); % I prefer to order the state-vector as [r;v], but this is purely convention
T = T*V/norm(V); % Just setting the thrust parallel to V, adjust to your case.
F_drag = -D/m*V(:);
F_thrust = T(:)/m;
% Calculate the other forces on your particle too
dydt = V; %
d2ydt2 = [F_thrust + F_drag - g*[0 0 1]]; % add the forces together
d2ydt2dydt = [d2ydt2; dydt];
HTH

R2020b

### Community Treasure Hunt

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

Start Hunting!