






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Assignment; Class: Flight Dynamics And Control; Subject: AAE-Aero & Astro Engineering; University: Purdue University - Main Campus; Term: Spring 2011;
Typology: Assignments
Limited-time offer
Uploaded on 04/27/2012
4.8
(18)10 documents
1 / 12
This page cannot be seen from the preview
Don't miss anything!
On special offer
February 11, 2011
p
h
gamma
alpha
V
S-Function
sfun_Cessna 182
Constant 1
th
Constant
el
0 50 100 150 200 250 300
130
135
140
145
150
155
160
Time (s)
V (ft/s)
Time History of V (Gliding)
0 50 100 150 200 250 300
0
1
2
3
4
Time (s)
alpha (deg)
Time History of alpha (Gliding)
0 50 100 150 200 250 300
0
2
Time (s)
gamma (deg)
Time History of gamma (Gliding)
0 50 100 150 200 250 300 350 400 450 500
160
165
170
175
180
185
190
195
200
205
Time (s)
V (ft/s)
Time History of Velocity (Horizontal Level Flight)
0 50 100 150 200 250 300 350 400 450 500 0
1
Time (s)
alpha (deg)
Time History of alpha (Horizontal Level Flight)
0 50 100 150 200 250 300 350 400 450 500
0
2
4
6
Time (s)
gamma (deg)
Time History of gamma (Horizontal Level Flight)
% sfun_pend_drag.m %CHANGE % S-function to describe the dynamics of a % Cessna 182 %CHANGE function [sys,x0,str,ts] = sfun_Cessna182(t,x,u,flag) %CHANGE % t is time % x is state % u is input % flag is a calling argument used by Simulink. % The value of flag determines what Simulink wants to be executed. switch flag case 0 % Initialization [sys,x0,str,ts]=mdlInitializeSizes; case 1 % Compute xdot sys=mdlDerivatives(t,x,u); case 2 % Not needed for continuous-time systems case 3 % Compute output sys = mdlOutputs(t,x,u); case 4 % Not needed for continuous-time systems case 9 % Not needed here end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % mdlInitializeSizes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function [sys,x0,str,ts]=mdlInitializeSizes % % Create the sizes structure sizes=simsizes; sizes.NumContStates = 6; %Set number of continuous-time state variables %CHANGE sizes.NumDiscStates = 0; sizes.NumOutputs = 5; %Set number of outputs %CHANGE sizes.NumInputs = 2; %Set number of inputs %CHANGE sizes.DirFeedthrough = 0; sizes.NumSampleTimes = 1; %Need at least one sample time sys = simsizes(sizes); % x0=[160; 0; 0; 0; 0; 3000]; % Set initial state %CHANGE str=[]; % str is always an empty matrix ts=[0 0]; % ts must be a matrix of at least one row and two columns % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % mdlDerivatives %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function sys = mdlDerivatives(t,x,u) % % Compute xdot based on (t,x,u) and set it equal to sys % sys= Cessna182_ode(t,x,u); %CHANGE % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% mdlOutput %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function sys = mdlOutputs(t,x,u) % % Compute xdot based on (t,x,u) and set it equal to sys sys = [x(1),x(2)180/pi,(x(3)-x(2))180/pi,x(5),x(6)]; %CHANGE
% Equations of motion for Cessna 182 in HW 5
function xdot = Cessna182_ode(t,x,u) global W S cbar J2 rho m xcm global CL0 CLa CLel global CDm k CLdm global CM0 CMa CMel global CMadot CMq CLadot CLq global epsilon eT eta
% Define some variables el = u(1); th = u(2); V = x(1); alpha = x(2); theta = x(3); q = x(4); qbar = 0.5rhoV^2; gamma = theta - alpha;
% Thrust T = 550theta/V;
% Drag CD = CDm + k(CL0+CLaalpha+CLelel - CLdm)^2; D = qbarS*CD;
% alphadot and Lift alphadot = (-qbarS(CL0 + CLaalpha + CLelel + cbar/(2V)CLqq) + Wcos(gamma) - Tsin(alpha-epsilon) + mVq)/(mV + qbarScbar/(2V)CLadot); CL = CL0 + CLaalpha + CLelel + cbar/(2V)CLadotalphadot + cbar/(2V)CLqq; L = qbarSCL;
% Moments MT = eTT; CM = CM0 + CMaalpha + CMelel + cbar/(2V)(CMadotalphadot + CMqq) - CLxcm/cbar; M = qbarScbar*CM;
% State-dots xdot(1) = (-D-Wsin(gamma)+Tcos(alpha-epsilon))/m; xdot(2) = alphadot;%(-L+Wcos(gamma)-Tsin(alpha-epsilon)+mVq)/(m*V);