Upload
ngongoc
View
217
Download
2
Embed Size (px)
Citation preview
Pitch Stability and Control Analysis of Flying Wing Aircraft
Joshua A. Sullivan
lindsayo
Pg. 2
Table of Contents
NOMENCLATURE 3
I. INTRODUCTION 3
II. RELEVANT THEORY 4
III. THEORETICAL ANALYSIS 5 A. STABILITY AND CONTROL DERIVATIVES FROM XFLR-‐5 5 B. STATE-‐SPACE MODELS AND CONTROLLER IMPLEMENTATION 6 C. PERFORMANCE SIMULATION 9
IV. EXPERIMENTAL ANALYSIS 10 A. WITHOUT SAS IMPLEMENTED 10 B. WITH SAS IMPLEMENTED 11
V. CONCLUSION 11
ACKNOWLEDGMENTS 12
APPENDIX 13
Pg. 3
Pitch Stability and Control Analysis of Flying Wing Aircraft
Joshua A. Sullivan University of California-San Diego Department of Mechanical and Aerospace Engineering
Pitch stability derivatives determined from software simulations are used to model the
longitudinal pitch behavior of a flying wing type aircraft. With no controller
implementation, this configuration is found to display marginal stability in pitch modes. So
as to design a more robust control structure, a stability augmentation system is enacted to
counteract disturbances to the otherwise marginally stable behavior. Root Locus design is
implemented to shape the dynamic response of the aircraft to an elevator command input
via proportional and derivative signal gains. The result is a step response that settles to a
reasonable pitch angle related to the elevator command, and rejects longitudinal
disturbances during flight. Finally, state-space models of both the stability-augmented
system and the original system are simulated so as to compare with real-time data collected
during flight tests.
Nomenclature [A] = State/System matrix [B] = Input matrix [C] = Output matrix [D] = Feedforward matrix b = Aircraft wingspan cBar = Mean geometric chord Cmq = Pitching moment coefficient Cmδe = Elevator effectiveness coefficinet D(s) = Controller transfer function G(s) = Aircraft dynamics transfer function IMU = Inertial Measurement Unit Iyy = Mass moment of inertia (y-axis) Ke = Elevator input command gain Kq = Derivative gain Kθ = Proportional gain LE/TE = Leading Edge/Trailing Edge Mde = Elevator effectiveness derivative
Mq = Pitching moment stability derivative OLHP = Open Left-Hand Plane (s-domain) q = Pitch Rate qBar = Dynamic pressure qDot = Rate of change of Pitch Rate S = Aircraft wing area SAS = Stability Augmentation System u = Control/Input vector V = Nominal aircraft speed x = State vector xDot = Derivative of State vector XFLR-5 = Aircraft analysis software y = Output vector δe = Elevator deflection δec = Elevator deflection command θ = Pitch Euler angle θDot = Rate of change of Pitch Euler angle
I. Introduction
HE analysis of pitch modal behavior is of particular importance to a flying wing aircraft because there is no
stabilizing tail to produce counteractive moments in response to flight disturbances. Furthermore, common flying
wing configurations share a common feature of having much longer wingspan than body length. This means that
T
Pg. 4
there is substantially less rotational inertia about the pitch axis, leading to increased sensitivity in the longitudinal
direction. Of the five general aircraft dynamic modes, the Short Period mode and Phugoid mode capture aircraft
pitch behavior. Phugoid modes have much slower natural frequencies and smaller damping ratios, while Short
Period modal behavior is often characterized by fast, highly damped pitching. For this particular application, only a
modified Short Period modal analysis is conducted because of its relevance to smaller, less maneuverable aircraft.
The first objective of this analysis is to model the aircraft dynamics via software simulation using XFLR-5 and
Stability/Control derivaties. From here, it becomes possible to design a Pitch SAS that tunes the aircraft dynamic
response to a favorable level. Finally, with a state-space model composed of the control and dynamics models , the
aircraft performance can be simulated using a 4th Order Runge Kutta iteration scheme. This simulated response will
give insight into the efficacy of the particular controller, as well as allow for comparison with actual flight data
measured with the onboard Inertial Measurement Unit.
II. Relevant Theory
With known aircraft dimensions, XFLR-5 is used to simulate elevator deflection at the trim condition, thus
giving Stability and Control Derivatives. The two derivatives of interest are the Pitching Moment Coefficient and
the Elevator Effectiveness Coefficient. From there, the following relationships can be used to find Pitch
Dimensional Derivatives:
€
Mq =q c 2S2VIyy
Cmq (1)
€
Mδe =q c SIyy
Cmδe (2)
The Short Period pitch mode dynamics, modified to exclude downward velocity considerations, are given by:
€
δ ˙ q δ ˙ θ
⎧ ⎨ ⎩
⎫ ⎬ ⎭
=Mq 01.0 0⎡
⎣ ⎢
⎤
⎦ ⎥ δqδθ
⎧ ⎨ ⎩
⎫ ⎬ ⎭
+Mδe
0⎧ ⎨ ⎩
⎫ ⎬ ⎭ δe
(3)
The state variables are pitch rate and pitch Euler angle. The variable of prime interest is the pitch Euler angle. The
Pitch SAS implements proportional and derivative feedback gains such that:
€
δe = Kq Kθ[ ] δqδθ⎧ ⎨ ⎩
⎫ ⎬ ⎭
+Keδec (4)
Using this control law in the original dynamics model yields the final state-space model:
€
δ ˙ q δ ˙ θ
⎧ ⎨ ⎩
⎫ ⎬ ⎭
=Mq + MδeKq MδeKθ
1.0 0⎡
⎣ ⎢
⎤
⎦ ⎥ δqδθ
⎧ ⎨ ⎩
⎫ ⎬ ⎭
+Mδe
0⎧ ⎨ ⎩
⎫ ⎬ ⎭ δec
(5)
Which is of general state-space form:
€
˙ x = A[ ] x + B[ ] u y = C[ ] x + D[ ] u (6)
Pg. 5
For general Root Locus design, the system transfer function should be rearranged such that stable poles and a system
gain can be realized. The general form for the Root Locus plot is:
€
1+K num(s)den(s)
⎛
⎝ ⎜
⎞
⎠ ⎟ = 0
(7)
III. Theoretical Analysis
The following section outlines all analysis done to model the aircraft modal behavior and stability. The work
shown in this section will be complemented by experimental results presented in later sections.
A. Stability and Control Derivatives from XFLR-5
A detailed model of the aircraft was created in the simulation and analysis software XFLR-5 to evaluate the one
stability and one control derivative needed for the control model. Elevon control surfaces added to the trailing edge
of the wing were deflected from -10º to +10º in
pure elevator motion, and the stability and modal
behavior of the aircraft was recorded. Figure 1
shows the aircraft model with deflected elevators
and pressure color contours to indicate
aerodynamic performance (i.e lift and induced
drag). Upon full completion of the simulation, a
weighted average of the necessary coefficients
was conducted to find the nominal values that
would be used to evaluate the dynamic model of
the aircraft, and to simulate all further behavior.
The weighted average was conducted by
assuming that the majority of the flight would take place within ± 5º elevator deflection. Table 1 displays all the
relevant resulting parameters from the XFLR-5 simulation. The final two values of Table 1 were evaluated using
Eq. (1) and Eq. (2) respectively. These values will be used later in the state-space models described by Eq. (3) and
Eq. (5).
Figure 1. XFLR-5 Model of Flying Wing.
Table 1. Relevant Stability and Control Coefficients, and Dimensional Derivatives
Cmq -0.7515 Cmδe -0.2472
Mq (1/s) -1.2607 Mδe(1/s2) -21.6243
Pg. 6
B. State-Space Models and Controller Implementation
With the appropriate parameters of Table 1, the aircraft dynamics described in the state-space model of Eq. (3)
were transformed to a plant transfer function, which is denoted G(s). This transfer function describes the
relationship between elevator deflection and the state variable of interest- pitch angle. G(s) is given by:
€
G s( ) =δθ s( )δe s( )
= KeMδe
s2 −Mqs
(8)
From this transfer function, it is evident that
there is one pole at s = 0 and one pole at s = +Mq.
As previously mentioned, the pole at zero causes
the plant to have marginal stability. While not
entirely unstable, a marginally stable system is on
the brink of reaching instability should the aircraft
experience a disturbance. Hence, marginal
stability is not sufficient for appropriate aircraft
SAS design. For simplicity, the elevator input
scaling gain, Ke, is held at a value of 1.0, so that
an elevator input command should produce an
equal change in pitch angle. The Root Locus plot
of the plant, shown in Fig. 2, displays the
marginally stable pole at zero. Furthermore, Fig.3
demonstrates a simulated response of the aircraft
plant to a unit step input to the elevator. Looking
at the step response, it’s clear that a unit step input
to the elevators causes an undamped and rapid
nose-down pitch of the aircraft. This behavior
reveals that the aircraft is indeed unable to reject
step disturbances without becoming unstable, and
thus indicates a need for feedback control.
To implement the Pitch SAS controller,
proportional and derivative gains will be used to
modify the state variable of interest- pitch angle.
The derivative of pitch angle, however, is simply
pitch rate; thus, both arguments for the controller
gains are readily measured from the onboard
Inertial Measurement Unit. Equation (4) displays this relationship, where the elevator deflection, δe has now been
replaced by the elevator deflection command given by the pilot, δec.
Figure 2. Root Locus plot of aircraft plant.
Figure 3. Step Response of aircraft plant.
Pg. 7
A system block diagram, composed of both the
system plant G(s), and the feedback controller D(s),
is shown in Fig. 4. Notice how this block diagram
satisfies the appropriate mathematical models given
by Eq. (3) and Eq. (4). Imposing Eq. (4) into Eq. (3)
results in the modified state-space model given by
Eq. (5), which now demonstrates the dynamic
relationship between pitch Euler angle output, and
elevator input command. Just as before with the
aircraft plant state-space model, the modified Pitch
SAS dynamics and plant can be modeled together. Looking at Fig. 4 again, the top branch is clearly the aircraft
dynamics plant. Below that are the two branches that make up the feedback controller. Therefore, the controller has
the following form:
€
D s( ) = Kqs+Kθ (9)
For a positive feedback loop such as this, the system transfer function is given by the following expression:
€
H s( ) =G s( )
1−D s( )G s( )
(10)
Since the objective of this analysis is to tune the controller gains via Root Locus design, it became imperative to
consider the closed-loop poles of the system transfer function, H(s), recalling the standard Root Locus form given by
Eq. (7). The following expression was used to conduct a Root Locus test:
€
1−D s( )G s( ) = 0→1+Kq
−KeMδe s+Kθ
Kq
⎛
⎝ ⎜ ⎜
⎞
⎠ ⎟ ⎟
s2 −Mqs
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥
= 0
(11)
Equation 11 is of the exact form as Eq. (7), and
hence a Root Locus plot using the bracketed
expression can be used to find the derivative gain Kq.
Recall that for simplicity, Ke is set at 1.0. Notice how
the ratio Kθ / Kq can be used to place a zero in the
OLHP, providing sufficient control to move the
originally vertical Root Locus branches further into
the OLHP. Mathematically, this will then allow for a
gain to be selected that has much better damping
qualities than the original plant model alone. The
Figure 5. Root Locus plot of controlled system.
Figure 4. Control block diagram for Pitch SAS.
Pg. 8
resulting Root Locus plot for the now feedback controlled system is given in Fig. 5. Notice how, when compared to
the purely vertical branches of the Root Locus plot in Fig. 2, the new Root Locus branches are pulled leftward into
the OLHP by the presence of the zero placement. This zero placement is what allows for the aircraft dynamics to be
altered to produce more a responsive and operable pitch control interface.
Using MATLAB’s Root Locus package, a gain can be selected that graphically satisfies stability requirements
and damping needs. Ideally, damping would be very high, but this usually requires high gains that will saturate the
mechanical systems or lead to very high settling
times. Therefore, it’s prudent to find gains that
provide sufficient damping, while allowing for the
system to settle reasonably fast. These responsive
behaviors can again be viewed by considering the
system step response. Therefore, after
implementing a Root Locus pole/gain selection, all
controller gains were determined and the feedback
loop was implemented. The step response shown in
Fig. 6 is the resulting system behavior. Notice now
how the system damps with very little overshoot,
and settles to a value of approximately -1.0 very
quickly. Recall that the elevator command gain, Ke, was set to 1.0, thus indicating that a positive
elevator unit step input (TE down) should lead to a nose-down pitch (negative convention) of equal magnitude.
Therefore, the fact that the step response settles to roughly -1.0 indicates this very behavior. Should it be more
useful to have the aircraft pitch more or less than the elevator
deflection, the gain Ke can be changed to accommodate this
requirement. Table 2 contains the resulting controller gains, as
well as the system damping ratio and natural frequency. Both
the damping and frequency are within reasonable range for a
Short Period modal analysis, indicating solid controller design.
In regards to disturbance rejection, the system’s impulse response can give excellent insight into how the system
responds to sudden disturbances of severe, but fleeting magnitude. Ideally, the impulse plot should show the system
response leveling out at approximately zero. This indicates that the system is able to reject impulse disturbances,
and that it is able to do so with zero steady-state error. Figure 7 is the simulated impulse response of the aircraft
with Pitch SAS enabled. Just as desired, the system response settles at zero, indicating full impulse disturbance
rejection and one-to-one user input tracking. The impulse response does show the rather severe pitching behavior
that occurs right at the onset of the disturbance, but considering that an impulse is an idealized input with infinite
Figure 6. Controlled system step response.
Table 2. Resultant Controller Parameters
Kq 0.251
Kθ 1.004
Ke 1.0
ζ 0.73
ωn (rads/s) 4.28
Pg. 9
magnitude, the fact that the aircraft still returns to
zero steady-state error is indicative of stable control.
Utilizing MATLAB to run the Root Locus design
process allowed for quick iteration through various
controller gain choices to find the ones that resulted
in the best system responses. The next step in
evaluating the theoretical performance of the
aircraft and Pitch SAS was to run a state-space
performance evaluation, to model how the system
might actually appear on logged flight data. This is
the topic of the next section.
C. Performance Simulation
With a full dynamic model complete, it was then possible to run a state-space simulation of the aircraft
performance. The models- one without Pitch SAS and one with Pitch SAS- were created using 4th Order Runge
Kutta iterations with the state-space models given in Eq. (3) and Eq. (5), respectively. For each model, a time span
of 20 seconds is considered. During that span, a +10º rudder input (TE down) was commanded for 5 seconds,
followed by zero input, and then followed by a -10º rudder input (TE up) for 5 seconds. Both pitch Euler angle and
pitch rate were simulated, since both of these measurements are available from the IMU measurements. Figure 8
shows the pitch rate response, and Fig. 9 shows the pitch Euler angle response. Note that the vertical axes on both
simulations have two different sets of scalings, one for the response without the Pitch SAS enacted and one for the
response with the Pitch SAS enabled. This is because, without the controller activated, the responses were often of
much higher magnitudes than those being controlled by the SAS.
Figure 7. Impulse response of controlled system.
Figure 8. Pitch rate simulation.
Figure 9. Pitch angle simulation.
Pg. 10
Looking at the pitch rate behavior, the sharp changes in stabilized pitch rate at the onset of the elevator command
are mostly due to the discontinuous nature of a step input. Obviously, the simulated pitch rates quickly settle to zero
whie the constant step command is given- an ideal behavior to witness. On the other hand, the unstabilized pitch
rate continues to increase to much larger magnitudes during the entire step command than that displayed on the
stabilized vertical axis. It is only when the command is changed that the pitch rate begins to lessen and return to
zero. Similarly, the pitch angle magnitude with deactivated SAS rapidly increases during the constant step
command, indicating inherent aircraft pitch instability. It is the the active SAS pitch angle response that is of
particular interest. As indicated in the simulation in Fig. 9, for a +10º elevator command, the aircraft holds at pitch
Euler Angle of -10º for the entire step command. Once the command is released, the pitch angle returns to zero,
with only slight overshoot and settling time. Similarly, a -10º elevator command holds the aircraft at +10º pitch
angle. This one-to-one relationship between elevator command and aircraft pitch attitude is due to the elevator
command gain, Ke, being set to 1.0, as well as the controller gains being selected to yield a step response that settles
at approximately -1.0.
IV. Experimental Analysis
The final objective of the procedure was to implement the controller into the actual aircraft operational software.
The onboard processor is an Arduino UNO board, connected with an IMU that contains a 3-axis rate gyro chip, a 3-
axis accelerometer chip, and a 3-axis magnetometer chip. The processor is connected to a receiver which picks up
pilot input commands sent through a transmitter. The Pitch SAS simply follows the math displayed in Eq. (4),
namely that the elevator deflection is the summation of the pilot command with the controller-gain-scaled
measurements of pitch angle and pitch rate. Data is being logged with an OpenLog using a microSD memory card.
A. Without SAS Implemented
Beginning with the baseline
performance of the aircraft, flight data
was taken with no stability controller
programmed onto the onboard
processor. Figure 10 shows the
resulting pitch angle and elevator
angle data from a complete non-
stabilized flight. It is evident from the
plot that there is not the mirrored
relationship between elevator input
and pitch angle output that was seen in
the state-space models. The
sporadically fluctuating elevator inputs
Figure 10. Real-time pitch angle and elevator input data without
SAS controller.
Pg. 11
shown in the plot indicate that the pilot was constantly having to adjust the aircraft to maintain flight. Ultimately,
this is due to the inherently unstable configuration of the aircraft plant dynamics discussed in prior sections.
Without a feedback loop to utilize real-time measurements, the control is completely dependent on the pilot.
B. With SAS Implemented
On the other hand, the pitch
stabilized system should certainly
react with behavior that is very close
to the one-to-one response shown by
the step response of Fig. 6. Therefore,
it would be expected that a plot of
elevator command vs. time
superimposed on a plot of pitch angle
measurement vs. time would produce a
graph with approximate symmetry
about the x-axis. This is precisely
what is seen in Figure 11, which plots
the real-time logged data of a flight
utilizing Pitch Stability Augmentation.
In this configuration, a pilot input to
the onboard receiver gets scaled by Ke, which is assumed to be 1.0, and then added to scaled measurements of pitch
angle and pitch rate. This final summation is then the input into the elevator servos, which implement the control
law and produce the plotted behavior.
V. Conclusion
Overall, it was determined via software simulation using XFLR-5 that the flying wing configuration under
consideration was inherently marginally stable in pitch behavior. A mathematical model for the pitch dynamics was
formulated, and the Root Locus of that model was plotted. This plot provided the starting point for a controller
implementation that involved using proportional and derivative gains to place a zero in the OLHP and drive the Root
Locus branches leftward. This opened up the possibility of choosing controller gains that would allow for maximum
damping with minimum overshoot and settling time. The result was a stable step response and impulse response,
that then yielded stable and predictable state-space simulations. In actual flight, the non-stabilized aircraft did not
display overtly drastic and devastating instability, but rather required the pilot to be continuously altering elevator
control to counteract disturbances. The stability augmented system, however, served its purpose of stabilizing
around a particular pilot input, and moderately rejected disturbances. All in all, it is evident that the Pitch Stability
Augmentation System stabilized the originally unstable flight dynamics of the flying wing, proving the merits of
implementing proportional-derivative feedback controllers to reduce pitch instability.
Figure 11. Real-time pitch angle and elevator input data with SAS
controller activated.
Pg. 12
Acknowledgments
Firstly, I would like acknowledge my excellent teammates Gamer Kesheshe, Tim Wheeler, and Karcher Morris,
without whose work I would have never been able to complete this analysis in a timely fashion. I would also like to
thank Dr. Anderson for teaching every bit of theory needed to complete the analysis, and for having the patience to
remind me of it every time I had a question.
Pg. 13
Appendix
A. MATLAB code
a. Execution Script
clear all close all clc %---Conversion Factors ---% in2m = 0.0254; rads2deg = 180/pi; %---Aircraft Parameters ---% %--------------------------% % Stabilit/Control Coefficients Cmq = -0.751493333; Cmde = -0.247204286; % Dimensional/Performance ct = 6.875*in2m; cr = 10.9375*in2m; b = 30*in2m; Iyy = 0.01; lamda = ct/cr; S = .5*b*cr*(1+lamda); V = 6; rho = 1.225; cBar = (2/3)*cr*((1 + lamda + (lamda*lamda))/(1 + lamda)); qBar = .5*rho*V*V; %---Stability and Control Derivatives ---% %----------------------------------------% Mq = (qBar*cBar*cBar*S*Cmq)/(2*V*Iyy); Mde = (qBar*cBar*S*Cmde)/Iyy; %---State-Space/Transfer Function Models ---% %-------------------------------------------% % Plant A_Plant = [Mq 0; 1 0]; B_Plant = [Mde;0]; C_Plant = [0 1]; D_Plant = 0; [numPlant, denPlant] = ss2tf(A_Plant,B_Plant,C_Plant,D_Plant); Plant = tf(numPlant, denPlant); figure(1) sgrid on;
Pg. 14
rlocus(-Plant); title('Plant, G(s), Root Locus') print('-dpng','-r300','PlantRL') [yStepG, tStepG] = step(Plant); figure(2) plot(tStepG,yStepG) grid on title('Plant Step Response','FontSize',16) xlabel('Time, sec','FontSize',14) ylabel('\delta\theta, rads','FontSize',14) % Implement/Tune Controller % Kq = 0.2508; KTheta_Kq = 4; L = tf(-[Mde (Mde*KTheta_Kq)],[1 -Mq 0]); figure(3) sgrid on rlocus(L) [Kq,Poles] = rlocfind(L); KTheta = KTheta_Kq*Kq; Controller = tf([Kq KTheta],1); % System System = feedback(Plant, Controller, +1); [yImp,tImp] = impulse(System); figure(4) plot(tImp,yImp) grid on title('System Impulse Response','FontSize',16) xlabel('Time, sec','FontSize',14) ylabel('\delta\theta, rads','FontSize',14) [yStep,tStep] = step(System); figure(5) plot(tStep,yStep) grid on title('System Step Response','FontSize',16) xlabel('Time, sec','FontSize',14) ylabel('\delta\theta, rads','FontSize',14) %---Simulation Model---% %----------------------% x_1(1,1) = 0; x_1(2,1) = 0; x_2(1,1) = 0; x_2(2,1) = 0; u(1,1) = 0; dt = 0.1;
Pg. 15
time = 0:dt:25; for i = 1:length(time) - 1 de_cmd = 0.0; if (time(i) >= 5.0) de_cmd = 10/rads2deg; end if (time(i) >= 10.0) de_cmd = 0; end if (time(i) >= 15.0) de_cmd = -10/rads2deg; end if (time(i) >= 20.0) de_cmd = 0; end u(1,i) = de_cmd; r1_sim1 = dt*PitchMode(x_1(:,i),u(1,i),0,Mq,Mde,Kq,KTheta); r2_sim1 = dt*PitchMode(x_1(:,i) + (0.5*r1_sim1),u(1,i),0,Mq,Mde,Kq,KTheta); r3_sim1 = dt*PitchMode(x_1(:,i) + (0.5*r2_sim1),u(1,i),0,Mq,Mde,Kq,KTheta); r4_sim1 = dt*PitchMode(x_1(:,i) + r3_sim1,u(1,i),0,Mq,Mde,Kq,KTheta); x_1(:,i+1) = x_1(:,i) + ((1/6)*(r1_sim1 + (2*r2_sim1) + (2*r3_sim1) + r4_sim1)); r1_sim2 = dt*PitchMode(x_2(:,i),u(1,i),1,Mq,Mde,Kq,KTheta); r2_sim2 = dt*PitchMode(x_2(:,i) + (0.5*r1_sim2),u(1,i),1,Mq,Mde,Kq,KTheta); r3_sim2 = dt*PitchMode(x_2(:,i) + (0.5*r2_sim2),u(1,i),1,Mq,Mde,Kq,KTheta); r4_sim2 = dt*PitchMode(x_2(:,i) + r3_sim2,u(1,i),1,Mq,Mde,Kq,KTheta); x_2(:,i+1) = x_2(:,i) + ((1/6)*(r1_sim2 + (2*r2_sim2) + (2*r3_sim2) + r4_sim2)); end u(1,i+1) = 0; figure(6) subplot(2,1,1) [AX1,H1_1, H1_2] = plotyy(time,x_1(1,:)*rads2deg,time,x_2(1,:)*rads2deg); grid on xlabel('Time, sec','FontSize',14) ylabel('Pitch rate, q, deg/sec','FontSize',14,'Color','k') title('Aircraft Pitch Rates, q','FontSize',16) legend('Without Pitch SAS','With Pitch SAS','Location','NorthWest') set(AX1(2),'ytick',[-30 -20 -10 0 10 20 30]); subplot(2,1,2) plot(time,u(1,:)*rads2deg);
Pg. 16
grid on xlabel('Time, sec','FontSize',14) ylabel('Elevator Command, deg','FontSize',14) axis([0 time(1,end) -15 15]) figure(7) subplot(2,1,1) [AX2,H2_1, H2_2] = plotyy(time,x_1(2,:)*rads2deg,time,x_2(2,:)*rads2deg); grid on xlabel('Time, sec','FontSize',14) ylabel('Pitch Euler Angle, \theta, deg','FontSize',14,'Color','k') title('Aircraft Pitch Angles, \theta','FontSize',16) legend('Without Pitch SAS','With Pitch SAS','Location','Best') set(AX2(2),'ytick',[-40 -30 -20 -10 0 10 20 30 40]); subplot(2,1,2) plot(time,u(1,:)*rads2deg) grid on xlabel('Time, sec','FontSize',14) ylabel('Elevator Command, deg','FontSize',14) axis([0 time(1,end) -15 15])
b. State-Space Dynamics Function “ PitchMode ”
function xDot = PitchMode(x,u,StabilizedBoolean,Mq,Mde,Kq,KTheta) if exist('Kq','var') ~= 1 Kq = 0.0; end if exist('KTheta','var') ~= 1 KTheta = 0.0; end if StabilizedBoolean == 0 % The simulation is seeking to model plant q = x(1,:); Theta = x(2,:); d_e = u; qDot = (Mq*q) + (Mde*d_e); ThetaDot = q; xDot = [qDot;ThetaDot]; end if StabilizedBoolean == 1 % The simulation is seeking to model SAS q = x(1,:); Theta = x(2,:); d_ec = u; qDot = ((Mq + (Mde*Kq))*q) + (Mde*KTheta*Theta) + (Mde*d_ec); ThetaDot = q; xDot = [qDot;ThetaDot]; end end