Professional Documents
Culture Documents
20/10/15, 7:46 AM
Page 1 of 4
20/10/15, 7:46 AM
minor modifications to the code. Any result (e.g., numerical values of the state history) can be displayed
in the MATLAB Command Window simply by removing the semi-colon at the end of the line. The flag
MODEL selects either the low-angle-of-attack, Mach-dependent model for BizJet A or the high-angle-ofattack, low-subsonic model for Bizjet B.
Page 2 of 4
20/10/15, 7:46 AM
hence, they are accounted for in the aerodynamic calculations. An ad hoc limit on the cosine of the pitch
angle is imposed to prevent singular calculations in near-vertical flight. This expediency introduces a
small error when the pitch angle is near +/-90 deg. The function event.m specifies a stopping condition
that terminates the simulation before the final time if the altitude goes below zero.
B.4.2 Cost Function for Aerodynamic Trim (TrimCost)
Download TrimCost.m
Trim control settings are calculated by minimizing the quadratic function of longitudinal accelerations
(i.e., rates of change of axial velocity, normal velocity, and pitch rate) contained in TrimCost. As shown,
equal weight is given to each component in the cost function, J, because the defining matrix, R, is an
identity matrix. The parameters that are adjusted to minimize J are the stabilator angle, the throttle setting,
and the pitch angle (which equals the angle of attack in steady, level flight). TrimCost calls EoM to
generate the needed accelerations. x1 and x3 are varied to maintain constant airspeed with varying angle
of attack.
B.4.3 Direction Cosine Matrix (DCM)
Download DCM.m
The direction-cosine (or rotation) matrix given by eq. 2.1-11 is implemented in the function DCM. The
matrix transforms vectors from the earth-relative frame of reference to the body-axis frame.
B.4.4 Linear System Matrices (LinModel)
Download LinModel.m
The function LinModel calls function EoM to generate f(x,u) and appends seven dummy elements to
account for the controls. Thus, xdotj is a function of [xT uT], and numjac calculates the Jacobian matrix
evaluated at the nominal values of state and control. The stability matrix, F, is contained in the upper-left
(12 x 12) partition, and the control-effect matrix, G, is contained in the upper-right (12 x 7) partition of the
Jacobian.
B.4.5 Wind Field (WindField)
Download WindField.m
WindField produces a three-component wind vector as a function of altitude, with linear interpolation
between tabulated points. The first point is tabulated at negative altitude to assure that no computational
problems occur at zero altitude. The wind vector is rotated to body axes for application in FLIGHT and
EoM.
B.4.6 Atmospheric State (Atmos)
Download Atmos.m
1976 U.S. Standard Atmosphere air density, air pressure, air temperature, and sound speed are generated
as functions of altitude by Atmos. The first point is tabulated at negative altitude to assure that no
http://www.princeton.edu/~stengel/FDcodeB.html
Page 3 of 4
20/10/15, 7:46 AM
Flight Dynamics.
http://www.princeton.edu/~stengel/FDcodeB.html
Last updated on June 12, 2015.
Copyright 2015 (c) by Robert F. Stengel. All rights reserved.
http://www.princeton.edu/~stengel/FDcodeB.html
Page 4 of 4