FLIGHT.m is a tutorial program, heavily commented to make interpretation easy. It provides a full six-degree-of-freedom simulation of an aircraft, as well as trimming calculations and the generation of a linearized model at any flight condition chosen by the user . Changes to aircraft control histories, initial conditions, flag settings, and other program control actions are made by changing the numbers contained in the code; there is no separate user interface. The code has been designed for simplicity and clarity not for speed of execution, leaving a challenge to the reader to find ways to make the program run faster. Numerous additions could be made to the code, including implementation of feedback control logic, simulation of random turbulence or microburst wind shear, and interfaces for real-time execution. No explicit or implicit warranties are made regarding the accuracy or correctness of the computer code.
FLIGHT.m is the script that calls program functions. Initial conditions are defined here, the three primary features (trim, linearization, and simulation) are enabled, and output is generated. Initial perturbations to trim state and control allow transient effects to be simulated. As shown, trimming for steady, level flight is accomplished by first defining a cost function, J, that contains elements of the state rate, then minimizing the cost using the Downhill Simplex (Nelder-Mead) algorithm contained in fminsearch. The longitudinal trimming parameters are stabilator angle, throttle setting, and pitch angle. The linear model is generated by numjac, a numerical evaluation of the Jacobian matrices associated with the equations of motion. The linear model is saved to disk files in the variables Fmodel and Gmodel. MATLAB's ode23, ode45, or ode15s integrate the equations of motion to produce the state history. The state history is displayed in time plots, with angles converted from the radians used in calculation to degrees. The reader can readily change the units of plotted quantities or add additional plots through 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 a low-angle-of-attack, Mach-dependent model for BizJet A  or a high-angle-of-attack, low-subsonic model for Bizjet B.
AeroModelMach.m uses aerodynamic and dimensional data contained in  with estimates of inertial properties of the generic business jet. Details of the configuration, such as sweep and aspect ratio of the wing and tail, are used in the estimates of Mach effects. Estimates of Mach effects are based on the Prandtl factor or the modified Helmbold equation. AeroModelAlpha.m for BizJet B is derived using handbook methods for estimating geometric, inertial, and aerodynamic characteristics. The model is first built using GeoMassAero.m, which saves three .mat files describing the airplane: InerGeo.mat, DataTable.mat, and RotCont.mat. AeroModelAlpha.m loads the .mat files for use in FLIGHT.m. The angle-of attack range extends from -10 to 90 deg based on conventional low-alpha and Newtonian high-alpha estimates. No Mach, landing gear, spoiler, or flap effects are considered.
The equations of motion for EoM.m are written using the flat-earth assumption . 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.
Trim control settings are calculated by minimizing a quadratic function of longitudinal accelerations (i.e., rates of change of axial velocity, normal velocity, and pitch rate) contained in TrimCost.m . TrimCost.m calls EoM.m to generate the needed accelerations. The direction-cosine (or rotation) matrix is implemented in the function DCM.m . The matrix transforms vectors from the earth-relative frame of reference to the body-axis frame. LinModel.m produces state and control Jacobian matrices for a linear, time-invariant model at the trim setting. the Jacobian matrix evaluated at the nominal values of state and control. WindField.m produces a three-component wind vector as a function of altitude, with linear interpolation between tabulated points . 1976 U.S. Standard Atmosphere air density, air pressure, air temperature, and sound speed are generated as functions of altitude by Atmos.m.
 Stengel, Flight Dynamics, Princeton University Press, Princeton, 2004.
 Soderman, P. T., and Aiken, T. N., "Full-Scale Wind-Tunnel Tests of a Small Unpowered Jet Aircraft with a T-Tail," NASA TN D-6573, Washington, DC, Nov. 1971.
Robert Stengel (2021). Mathematical Models and Six-Degree-of-Freedom Simulation of Two Business Jet Aircraft (https://www.mathworks.com/matlabcentral/fileexchange/53821-mathematical-models-and-six-degree-of-freedom-simulation-of-two-business-jet-aircraft), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!