0% found this document useful (0 votes)
52 views19 pages

System IDentification Programs

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views19 pages

System IDentification Programs

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

https://ntrs.nasa.gov/search.jsp?

R=20030006686 2019-11-13T17:11:00+00:00Z

AIA A

AIAA-2002-4704

System IDentification Programs


for AirCraft (SIDPAC)

Eugene A. Morelli
NASA Langley Research Center
Hampton, VA

AIAA Atmospheric Flight Mechanics Conference


August 5-8, 2002 / Monterey, CA

For permission to copy or to republish, contact the American Institute of Aeronautics and Astronautics,
1801 Alexander Bell Drive, Suite 500, Reston, VA, 20191-4344
AIAA-2002-4704

S_YSTEM IDENTIFICATION PROGRAMS FOR AIRCRAFT (SIDPAC)

Eugene A. Morelli

NAb)/Langley Research Center


Hampton, Virginia USA 23681 2199

Abstract and software. Many computer programs for aircraft


system identification have been developed over the
A collection of computer programs for aircraft
years, but most have been written in FORTRAN, and
system identification is described and demonstrated.
have been designed to address a specific type of
The programs, collectively called S_S_S__
stem
problem, usually using methods best suited to the
IDentification Programs for AirCraft, or SIDPAC, were
application for which the program was developed. The
developed in MATLAB ® as m-file functions. SIDPAC
existing programs are scattered among different
has been used successfully at NASA Langley Research
organizations and people, and many have limited
Center with data from many different flight test
availability. Significant time and effort can be required
programs and wind tunnel experiments. SIDPAC
to learn how to compile and operate a particular
includes routines for experiment design, data
program competently. This effort is in addition to the
conditioning, data compatibility analysis, model
time and effort involved in learning what the program
structure determination, equation-error and output-
actually does, how the methods are implemented, and
error parameter estimation in both the time and
how to properly interpret the results.
frequency domains, real-time and recursive parameter
estimation, low order equivalent system identification, S_S_S__stem
IDentification Programs for AirCraft, or

estimated parameter error calculation, linear and SIDPAC, is a collection of computer programs that
nonlinear simulation, plotting, and 3-D visualization. implement a variety of methods for solving problems

An overview of SIDPAC capabilities is provided, along in the area of system identification applied to aircraft.
with a demonstration of the use of SIDPAC with real This paper describes the routines included in SIDPAC

flight test data from the NASA Glenn Twin Otter and demonstrates SIDPAC using a real flight test data
aircraft. The SIDPAC software is available without example. All SIDPAC programs were written in
MATLAB ® as m-file functions. An m-file function in
charge to U.S. citizens by request to the author,
contingent on the requestor completing a NASA MATLAB ® is the analog of a subroutine in
software usage agreement. FORTRAN or a function in C.

MATLAB ® is a platform-independent language


Introduction
that is easy to learn and program. MATLAB ® also has
Developing mathematical models of physical many built-in functions for linear algebra, data
systems based on imperfect observations or analysis, plotting, and debugging, and uses double

measurements is known as system identification. precision arithmetic by default. These characteristics


When the system to be modeled is an aircraft, the make MATLAB ® an excellent choice for

models are generally dynamic with multiple inputs and implementing SIDPAC algorithms.
outputs, and the measurements are noisy. As a result,
All of the algorithms implemented in £TDPAC are
the required data volume is substantial, and most
based on information available in the open literature.
aircraft system identification tasks require computers The documents listed under References contain
information on the algorithms implemented in

Research Engineer, Senior Member AIAA SIDPAC. The references are grouped according to
e-mail: [email protected] a.gov their relevance to system identification problems
addressed in SIDPAC.
Copyright © 2002 by the American Institute of Aeronautics and
Astronautics, Inc. No copyright is asserted in the United States Development of SIDPAC occurred over a period
under Title 17, U.S. Code. The U.S. Government has a royalty- of approximately 10 years at NASA Langley Research
free license to exercise all rights under the copyright claimed Center. The author wrote and tested all of the SIDPAC
herein for Governmental purposes. All other rights are reserved by routines. Most of the routines in SIDPAC were
the copyright owner.

American Institute of Aeronautics and Astronautics


originally coded as m-file functions, but a few were MATLAB ® command line, then executed with a
translated and adapted from FORTRAN codes that carriage return.
have been used for many years. SIDPAC has been and
The SIDPAC m-files were originally written for
continues to be used at NASA Langley Research
research purposes and not for public release, so error
Center for system identification applied to data from
handling, user interface, and the like, are Spartan.
various flight test programs and wind tunnel
However, the software is fully documented and
experiments.
liberally commented.
Software tools for specific system identification
The next section gives an overview of the
tasks are implemented in SIDPAC as individual m-file
SIDPAC software by listing m-files in several system
functions, which may call other supporting m-file
identification problem categories, along with short
functions. The comment header for each SIDPAC
narrative descriptions of what each m-file does.
routine includes calling syntax, descriptions of inputs
Following this, example applications of selected
and outputs, the creation and modification history, and
a list of called SIDPAC routines. SIDPAC makes use routines in SIDPAC to real flight test data analysis and
modeling problems are presented and discussed.
of a few MATLAB ® routines from the Signal
Processing Toolbox and the Control Systems Toolbox,
SIDPA C Overview
sold by The MathWorks, Inc., but SIDPAC also
includes alternate routines that can be used if these Nearly every system identification problem has
MATLAB ® toolboxes are not available to the user. some aspect that makes it unique. Therefore, it is only
There are also a few C mex files included in SIDPAC a slight exaggeration to say that every system
to increase processing speed for certain tasks, but identification problem is a special case. Because of
again, there are alternate routines that can be used if a this, SIDPAC does not include much in the way of
C compiler is not available to the user. SIDPAC is automated analysis or decision-making. Instead,
therefore a complete set of programs for aircraft system SIDPAC implements a wide variety of system
identification, requiring only the standard built-in identification methods as individual m-files. SIDPAC
MATLAB ® functions. includes Graphical User Interfaces (GUI) that aid the
analyst in routine tasks such as unit conversion, signal
SIDPAC was developed and tested under
definition, and data compatibility analysis. Beyond
MATLAB ® 5.2, release 11, and MATLAB ® 6.1,
this, the spectrum of choices for inputs and outputs,
release 12.1, on an IBM-compatible personal
model forms, transformations, data analysis, and
computer. SIDPAC software will work properly on
modeling methods is so broad, and the problems are so
any computer running MATLAB ® 5.2 or higher.
diverse, that the development of a GUI for these
Since SIDPAC is very much like a MATLAB ®
purposes would be either very complicated or not
toolbox, the computing hardware and operating system
effective. Therefore, after the initial data reduction,
requirements for SIDPAC are the same as for
SIDPAC m-files must be called individually from the
MATLAB ®.
MATLAB ® command line. This forces the analyst to
The descriptions and demonstrations included be cognizant of what methods are being used and how
here apply to SIDPAC version 1.1, which is the latest the methods are implemented. This level of contact
version as of this writing. SIDPAC version 1.1 with the methods and software is essential for

software was sent to all registered SIDPAC users via obtaining good results.
e-mail just prior to public release of this paper.
It is a simple matter to create custom data
Calling syntax and descriptive material in the analysis and modeling scripts in MATLAB ® for
header of each SIDPAC m-file are displayed in the particular system identification problems, using calls to
MATLAB ® command window in response to typing SIDPAC m-files. This is demonstrated in the Examole
help filename, where filename is the name of a section. The resulting script can be used to automate
specific m-file. All SIDPAC m-files have the the analysis for different maneuvers, and has the added
customary .m file extension. MATLAB ® is an benefit of completely documenting the data analysis
interpretive language, so the source code runs directly and modeling process.
in the MATLAB ® environment, with no requirement
The m-file functions that comprise the main
for explicit compile and link commands. To execute
capabilities of SIDPAC are categorized below
any m-file in SIDPAC, the correct calling syntax can
according to functionality. Short narrative descriptions
be copied from the comment header directly to the
of the m-files appear below each category heading.

American Institute of Aeronautics and Astronautics


Them-filesdescribed hererepresent
onlya partial fint.m - Computes a high-accuracy finite Fourier
listingofthecontents
of£TDPAC. integral for arbitrary frequencies, using measured time
Data Analysis series data.

accel cor.m - Corrects accelerometer measurements fixdrop, m -Manually fixes data dropouts.
from the sensor location to the aircraft c.g.
hsmoo.m -Implements a posteriori low-pass filtering
axcnv.m - Finds vector components in a rotated using fixed weight smoothing.

coordinate system.
pwrband.m - Computes the frequency band that
bodecmp.m - Compares Bode plots for general contains a given fraction of the power in a time series.
transfer function models.
smoo.m - Separates signal from noise for a measured
bodeplt.m -Draws Bode plots. time series, using Fourier analysis and an optimal
Wiener filter.
chirpz.m - Computes the chirp-Z discrete Fourier
transform. spect.m - Computes power spectral density for a
measured time series.
cmpplt.m - Plots two time series and their difference.
tshiff.m - Estimates the relative time shift between two
cmpsigs.m - Scales and removes biases from two
time series, using time-domain cross correlation.
time series so their waveforms can be compared.
xsmep.m - Computes smoothed endpoints for a
compfc.m - Computes non-dimensional applied force measured time series.
coefficients based on measured data.
Experiment Design
compmc.m - Computes non-dimensional applied
moment coefficients based on measured data. compcrb.m - Computes the Cram6r-Rao bounds and
the information matrix.
compzsd.m - Computes a smoothed numerical time
derivative of noisy time series using Fourier analysis dox.m - Generates modern experiment designs for
and the Wiener filter in the frequency domain. response surface modeling.

correl.m - Computes the estimated parameter mkfswp.m - Generates a linear or logarithmic


correlation matrix. frequency sweep input.

corx.m - Computes the normalized regressor mkrandss.m - Generates a sum of sine waves with
correlation matrix. random amplitudes and frequencies.

csrnep.rn - Computes smoothed endpoints for a noisy mkrdn.m - Generates white or arbitrarily colored
time series using a local cubic least squares fit. random noise inputs.

cubic_dtrend.m - Computes a cubic detrend function mksqw.m - Generates an alternating square wave
for a noisy time series. input with arbitrary amplitudes and pulse widths.

cutItd.m - Plots flight test data and implements mksswp.m - Generates a Schroeder sweep input.
manual cutting of flight test maneuver data lengths.
Data Compatibility Analysis
deriv.m - Computes a smoothed numerical time
a irch k. m - Checks the compatibility of measured data
derivative of noisy time series using local least squares
for translational accelerations, body-axis angular rates,
polynomial fits to the data.
airspeed, sideslip angle, and angle of attack.
dIt.m - Computes the discrete Fourier transform using
the definition (i.e., without using a Fast Fourier
compat.m - Estimates instrumentation error

Transform algorithm). parameters from measured input-output time-domain


data, using output-error maximum likelihood.
estlag.m - Estimates the pure time delay between two
dcmp.m -Integrates aircraft kinematic equations for
time series, using the maximum slope projection
method described in MIL-STD 1797A. data compatibility analysis.

sens_cor.m - Applies instrumentation error


corrections to measured data.

American Institute of Aeronautics and Astronautics


least squares regression formulation, both
rotchk.m - Checks the compatibility of measured data
conventionally and accounting for colored residuals.
for body-axis angular rates and Euler angles.
colores.m - Computes corrected parameter standard
Model Structure Determination
errors by post-processing results from output-error
gsorth.m - Generates a set of mutually orthogonal maximum likelihood parameter estimation (oe.m).
regressors using Gram-Schmidt orthogonalization. The correction accounts for the practical fact that
output-error residuals are usually colored, not white, as
swr.m - Identifies general multivariate models from
assumed in the output-error maximum likelihood
measured input-output data using least squares theoretical formulation. Corrected parameter standard
stepwise regression, and computes parameter estimates errors from colores.m are consistent with the scatter in
and error bounds. This routine requires interactive
parameter estimates from repeated flight test
input from the analyst to identify the model structure.
maneuvers, and therefore accurately represent
The routine can handle either real or complex data, so
estimated parameter uncertainty.
the same routine can be used for time-domain or

frequency-domain data. m_colores.m - Vectorized version of colores.m,


which runs much faster and gives the same results as
offit.m - Identifies general multivariate models from colores.m.
measured input-output time-domain data, and
computes parameter estimates and error bounds. Real-Time Parameter Estimation
Multivariate orthogonal basis functions generated from
rft.m - Computes the recursive discrete Fourier
the measured data are used to identify the model
transform of a time series.
structure. This routine can be run autonomously or
with interactive input from the analyst. rtpid.m - Computes sequential real-time estimates of
dynamic model parameters and the associated
pfstat.m - Computes the partial F statistic for
covariance matrix, using equation-error in the
hypothesis testing in model structure determination.
frequency domain.

Equation-Error Parameter Estimation


rlesq.m - Computes equation-error model parameter
estimates and covariance matrix estimates for a linear
lesq.m - Estimates equation-error model parameters
using a linear least squares regression formulation. least squares regression problem, using a recursive
formulation. This routine is the recursive version of
This routine can be used with either real or complex
data, so the same routine can be used for time-domain lesq.m.

or frequency-domain data.
slesq.m - Computes equation-error model parameter
estimates and covariance matrix estimates for a linear
Output-Error Parameter Estimation
least squares regression problem, using a batch
mnr.m - Computes the modified Newton-Raphson formulation applied to sequential sections of data. This
step for multi-dimensional parameter optimization, and routine is the sequential version of lesq.m.
computes the cost gradient and information matrix.
Frequency Domain Parameter Estimation
oe.m - Estimates dynamic model parameters from
measured input-output time-domain data using fdoe.m - Estimates dynamic model parameters from

output-error maximum likelihood. This routine uses measured input-output frequency-domain data using
general dynamic model definition m-files that can be output-error maximum likelihood. This routine is the
linear or nonlinear. frequency-domain equivalent of oe.m.

senest.m - Computes sensitivity estimates using finite tfest.m - Estimates parameters in a transfer function
differences. model structure, using equation-error in the frequency
domain and fint.m to compute high-accuracy finite
simplex.m - Implements the simplex method for Fourier integrals for arbitrary frequencies.
multi-dimensional parameter optimization without cost
function gradients. Ioest.m - Estimates parameters in a low order
equivalent system transfer function model structure,
Estimated Parameter Error Bounds
using the same approach as in tfest.m, except that a
relaxation technique is used to estimate the equivalent
r_colores.m - Computes Cram6r-Rao bounds for the
covariances of the estimated parameters in a linear time delay parameter.

American Institute of Aeronautics and Astronautics


Utilities regcor.m - Computes and displays pairwise regressor
correlations.
abg.m- Implements third-orderAdams-Bashforth
numericalintegration. reggen.m - Generates multivariate polynomial
regressors.
adambg.m - Versionof abg.musedin parameter
estimation
algorithms. rms.m - Computes root mean square of the elements
of a vector.
adamb3.c - C mex-fileversionof adambg.mused
for highspeedcomputation in parameter
estimation rk2.m - Implements second-order Runge-Kutta
algorithms. numerical integration.

buzz.m- Addswhitenoisetoatimeseries. runk2.m - Version of rk2.m used in parameter


estimation algorithms.
colnse.m - Adds a selectable combination of white
noise and band-limited noise to a time series. runk2.c - C mex-file version of runk2.m used in

parameter estimation algorithms.


comfun.m - Computes the value of ordinary
polynomial functions. rk4.m - Implements fourth-order Runge-Kutta
numerical integration.
dband.m - Applies a dead band to a time series.
runk4.m - Version of rk4.m used in parameter
intl .m -Does one-dimensional linear interpolation.
estimation algorithms.

int2.m -Does two-dimensional linear interpolation. runk4.c - C mex-file version of runk4.m used in

intg.m -Does three-dimensional linear interpolation. parameter estimation algorithms.

Ioadflat.m - Reads a general ASCII flat file into the spl.m - Generates spline functions.

MATLAB ® workspace. ulag.m - Applies a selected time shift to a time series.

massprop.m - Assembles aircraft mass and moment


of inertia data. Example

misvd.m - Computes robust matrix inversion using To demonstrate the use and capabilities of
singular value decomposition. SIDPAC, a real flight test data analysis and modeling
problem is presented. This example was chosen so that
milstd.m - Computes longitudinal handling qualities some of the main elements of SIDPAC could be
level prediction according to MIL-STD 1797A, and demonstrated.
plots handling qualities parameters and boundaries.
The flight test data was obtained from a
model_disp.m - Displays the functional form and
longitudinal maneuver flown on the NASA Glenn
parameter values for a polynomial model.
Twin Otter aircraft, see Figure 1. The Twin Otter is a
ocf.m - Converts a transfer function numerator and twin-engine turboprop commuter aircraft equipped
denominator into a state space model in observer with high-quality flight research instrumentation.
canonical form.
The flight test data for the example maneuver was
plotmesh.m - Makes 3-D mesh plots for polynomial available in an ASCII file, with the measured quantities
models. named according to the convention used at NASA
Glenn. To use SIDPAC effectively, the first step is to
plotpest.m - Plots parameter estimates and error bars
put the data in a standard format that some of the
representing 95 percent confidence intervals.
SIDPAC routines expect. This is a simple matter of
plotsurf.m - Makes 3-D surface plots for polynomial unit conversions, routine calculations, and assembling
models. the data into an array called fdata in the MATLAB ®
workspace, where each column of the array is assigned
plot3d.m - Makes 3-D plots using data arranged for
a specific quantity. There is a GUI in SIDPAC to make
linear regression.
this process easier, which is invoked by simply typing
press, m - Computes predicted sum of squares metric. sid at the MATLAB ® command window prompt. The
resulting GUI is shown in Figure 2. The analyst can
ratelim.m - Implements rate limits.
use this GUI to quickly plot any of the workspace

American Institute of Aeronautics and Astronautics


variables,
convert units,thenassign theresultto the required problem-specific commands in the
appropriateplaceinthestandard datamatrixfdata A MATLAB ® command window (whether the current
sidebenefitofthisprocedure isthattheflighttestdata GUI is closed or not), then continue with the analysis
isautomaticallychecked formissinginformation asthe using the GUI.
analystassignsdatatothechannels inthestandard data Instrumentation error parameters can be found
matrixfdata In thisexample, themeasurement for using output-error parameter estimation and a default
headinganglepsi was missing. However,this selection for the instrumentation error model structure
measurement is not neededfor longitudinal data by simply clicking the Estimate Errors button in the
analysis
andmodeling. data compatibility GUI. Parameter estimation results
Forlarge-scale flighttestdataanalysis, thedata are stored and displayed in the MATLAB ® workspace.
reductionandchannel assignment process is typically Estimated instrumentation errors can be removed from
implemented by creating a script,sothatthe data the measured data by clicking the Correct Data
reductionstepscanberepeated automatically foreach button. Figure 6 shows the rotational data after the
maneuver. A scriptis simplya textfile containing estimated instrumentation corrections have been
commands that could havebeenissuedat the applied to the data. Figures 5 and 6 show how
MATLAB ® command prompt.Thecommands in the applying the estimated instrumentation error
scriptareexecuted by typingthenameof thescript corrections implements kinematic consistency among
file,omitting
thefileextension. Scriptfilesmusthave the measured outputs related to the pitch rotation.
the.mfileextension.
At this point, the data have been organized,
Theanalyst clicksontheNextbuttontoproceed plotted, checked for data compatibility, and corrected
tothenextGUI,shown inFigure 3,whichcanbeused using estimated instrumentation errors. The next steps
to cutthemaneuver datalength.Thiscapability is vary greatly depending on the goals of the
necessary becauseit iscommon forthedatatoinclude investigation. For this example, a script was developed
morethanis necessary fortheanalysis anddynamic to implement and document the data analysis and
modeling. Forexample, theremaybelongstretches of modeling process. Figure 7 shows a listing of the
steadytrimwithnodatainformation content,orit may script. Space does not permit showing all of the results
bethatthepilotapplieda different powersettingor generated from this script, but a short description will
changed theflightcondition neartheendofthedata, to be given here.
setupforthenextflighttestmaneuver. Inthelatter
case,the assumptions for the modelingmay be measuredThe initial commands in the script plot the
data and compute non-dimensional
violated,sothispartofthedatamustberemoved. The
aerodynamic coefficients. Next, body-axis Z force and
CutManeuver buttonallows theanalyst todefinethe pitching moment coefficients are modeled in an
beginning andendof themaneuver usinggraphical
equation-error formulation using least squares
(mouse) ornumerical (keyboard) input. regression and stepwise regression. Corrected
Clickingthe Next buttonagain,the analyst parameter error bounds are computed and displayed,
arrivesatthedatacompatibility analysisGUI,where along with the parameter estimates and confidence
the kinematic consistency of the measured output intervals. Modeling is then carried out in the
quantitiesis checked. Figure4 showsdata frequency domain, using a transfer function model and
compatibilityplotsofthemeasured airspeed,angleof equation-error parameter estimation. Following this,
attack,andsideslip angle,compared to reconstructedoutput-error parameter estimation in the time domain is
valuesobtainedfrom integratingthe kinematic used with a dynamic model file implementing the full
equations usingtranslationalaccelerationsandangular nonlinear equations of motion and a linear
ratemeasurements asinputs.Theanalogous check on aerodynamic model to estimate non-dimensional
theEuleranglemeasurements, usingthe rotational stability and control derivatives. A prediction case is
kinematic equations withangularratemeasurementincluded to demonstrate the validity of the identified
inputstoreconstruct theEulerangles, is shownwhen models and show the linear and nonlinear simulation
theanalyst selectstherotational optionfromthepull- capabilities. Plots of the results appear in the
downmenu attheupper rightoftheGUI,seeFigure 5. MATLAB ® figure window and various displays of
results appear in the MATLAB ® command window.
SIDPAC software was designed so that it is
possible to enter or exit any GUI at any time without Figure 8 shows one of the plots, which is a
adversely affecting results. The analyst can issue any comparison of the measured non-dimensional pitching

American Institute of Aeronautics and Astronautics


moment coefficient
withtheidentified
equation-error
model.Table1 containsparameter
estimation
results References
forthiscase.
Data Analysis
Theentiredemonstration
scriptin Figure7 is
availablein £TDPACas totterdemo.m. The Bendat, J.S. and Piersol, A.G. Random Data
Analysis and Measurement Procedures, 2nd Ed.,
demonstrationcanbe executed
by simplytyping
John Wiley & Sons, New York, NY, 1986.
totter_demoattheMATLAB®command prompt.
Gainer, T.G. and Hoffman, S. "Summary of

Concluding Remarks Transformation Equations and Equations of Motion


Used in Free-Flight and Wind-Turmel Data
A collection of computer programs called S_S_S__stem Reduction Analysis," NASA SP-3070, 1972.
IDentification Programs for AirCraft, or SIDPAC, was
Graham, R.J., "Determination and Analysis of
described and demonstrated on a real flight test data
Numerical Smoothing Weights," NASA TR R-179,
analysis and modeling problem. STDPAC was
December 1963.
developed and tested at NASA Langley Research
Center in the course of solving real problems in aircraft Lanczos, C. Applied Analysis, Dover Publications,
system identification. Inc., New York, NY, 1988.

STDPAC addresses a wide range of system Morelli, E.A. "Estimating Noise Characteristics

identification problems in a common MATLAB ® from Flight Test Data using Optimal Fourier

environment. MATLAB ® has many advantages, Smoothing," Journal of Aircraft, Vol. 32, No. 4,

including platform-independence, easy to learn and July-August 1995, pp. 689-695.

program, many built-in functions for linear algebra,


Data Compatibility Analysis
data analysis, debugging, plotting, and data
visualization, and the use of double precision Klein, V. and Morgan, D.R. "Estimation of Bias

arithmetic by default. These characteristics make Errors in Measured Airplane Responses using
Maximum Likelihood Method," NASA TM 89059,
MATLAB ® an excellent choice for implementing
STDPAC algorithms. January 1987.

Morelli, E. A., "Optimal Input Design for Aircraft


Relevant theory and practical considerations for
Instrumentation Systematic Error Estimation,"
the methods implemented in STDPAC are completely
AIAA paper 91-2850, AIAA Atmospheric Flight
described in the forthcoming text entitled System
Mechanics Conference, New Orleans, Louisiana,
Identification Applied to Aircraft Theory and
August 1991.
Practice, by V. Klein and E.A. Morelli. The SIDPAC
software is a product of NASA Langley Research Model Structure Determination
Center, and is available free of charge to U.S. citizens
Draper, N.R. and Smith, H. Applied Regression
by request to the author, contingent on the requestor
Analysis, 2nd Edition, John Wiley & Sons, New York,
completing a NASA software usage agreement.
NY, 1981.
Requests for the software should be e-mailed to:
Klein, V., Batterson, J.G., and Murphy, P.C.
[email protected]
"Determination of Airplane Model Structure from
Please include name, mailing address, e-mail Flight Data by using Modified Stepwise Regression,"
address, telephone number, and company affiliation of NASA TP-1916, October 1981.

the requestor, along with a one-sentence description of Morelli, E.A., "Global Nonlinear Aerodynamic
the intended use of SIDPAC, for technology transfer Modeling using Multivariate Orthogonal Functions,"
record-keeping purposes. Journal of Aircraft, Vol. 32, No. 2, March-April

SIDPAC allows a user to apply state-of-the-art 1995, pp. 270-77.

technology to aircraft system identification problems, Morelli, E.A., "Global Nonlinear Parametric
within a single, highly capable, and easy-to-use Modeling with Application to F-16 Aerodynamics,"
computing environment. ACC paper WP04-2, Paper ID i-98010-2, American
Control Conference, Philadelphia, Pennsylvania,
June 1998.

American Institute of Aeronautics and Astronautics


Morelli, E.A. and DeLoach, R., "Response Surface Morelli, E.A. "Identification of Low Order
Modeling using Multivariate Orthogonal Functions," Equivalent System Models from Flight Test Data,"
AIAA paper 2001-0168, 39 'h AIAA Aerospace NASA TM-2000-210117, August 2000.
Sciences Meeting and Exhibit, Reno, Nevada,
January 2001. Parameter Estimation in the Frequency Domain

Klein, V. "Aircraft Parameter Estimation in


Estimated Parameter Error Bounds
Frequency Domain," AIAA paper 78-1344, A/AA
Maine, R.E. and Iliff, K.W., "The Theory and Atmospheric Flight Mechanics Conference, Palo
Practice of Estimating the Accuracy of Dynamic Alto, CA, August 1978.
Flight-Determined Coefficients," NASA RP 1077,
Morelli, E.A. "High Accuracy Evaluation of the
July 1981. Finite Fourier Transform using Sampled Data,"
Morelli, E.A. and Klein, V. "Accuracy of NASA TM 110340, June 1997.
Aerodynamic Model Parameters Estimated from
Real-Time Parameter Estimation
Flight Test Data," Journal of Guidance, Control
and Dynamics, Vol. 20, No. 1, January-February Morelli, E.A. "In-Flight System Identification,"
1997, pp. 74-80. AIAA paper 98-4261, AIAA Atmospheric Flight
Mechanics Conference, Boston, MA, August 1998.
Equation-Error Parameter Estimation
Morelli, E.A., "Real-Time Parameter Estimation in
Klein, V., "Estimation of Aircraft Aerodynamic
the Frequency Domain," Journal of Guidance,
Parameters from Flight Data," Prog. Aerospace
Control, and Dynamics, Vol. 23, No. 5, September-
Sciences, Vol. 26, 1989, pp. 1-77.
October 2000, pp. 812-818.
Klein, V. and Morelli, E. A., "Parameter Estimation
Experiment Design
of a Highly Augmented Aircraft from Flight Data,"
9th IFAC/IFORS Symposium on Identification and Box, G.E.P., Hunter, W.G., and Hunter, J.S.,
System Parameter Estimation, Budapest, Hungary, Statistics for Experimenters An Introduction to
July 1991. Design, Data Analysis, and Model Building, John
Wiley & Sons, Inc., New York, NY, 1978.
Output-Error Parameter Estimation
Morelli, E.A., "Practical Input Optimization for
Maine, R.E. and Iliff, K.W., "Application of
Aircraft Parameter Estimation Experiments," NASA
Parameter Estimation to Aircraft Stability and
CR 191462, May 1993.
Control - The Output-Error Approach", NASA RP
1168, June 1986. Morelli, E.A., "Flight Test of Optimal Inputs and
Comparison with Conventional Inputs," Journal of
Taylor, L.W., Jr. and Iliff, K.W. "Systems
Aircraft, Vol. 36, No. 2, March-April 1999, pp. 389-
Identification using a Modified Newton-Raphson 397.
Method - A Fortran Program," NASA TN D-6734,
Schroeder, M.R. "Synthesis of Low-Peak-Factor
May 1972.
Signals and Binary Sequences with Low
Morelli, E.A. and Klein, V. "Determining the
Autocorrelation," IEEE Transactions on Information
Accuracy of Maximum Likelihood Parameter
Theory, January 1970, pp. 85-89.
Estimates with Colored Residuals," NASA CR
Williams, J.N., Ham, J.A., and Tischler, M.B.,
194893, March 1994.
"Flight Test Manual, Rotorcraft Frequency Domain
Low Order Equivalent System Identification Flight Testing," U.S. Army Aviation Technical Test
Center, Edwards AFB, CA, AQTD Project No.
Military Standard Flying Qualities of Piloted
Aircraft, MIL-STD-1797A, January 1990. 93-14, September 1995.

Morelli, E.A., "Low Order Equivalent System Software Implementation


Identification for the Tu- 144LL Supersonic
Using MATLAB ®, Version 6, The MathWorks, Inc.,
Transport Aircraft," AIAA paper 2000-3902, A/AA Natick, MA, 2000.
Atmospheric Flight Mechanics Conference, Denver,
Press, W.H., Flarmery, B.P., Teukolsky, S.A., and
Colorado, August 2000.
Vetterling, W.T. Numerical Recipes The Art of
Scientific Computing (FORTRAN Version),
Cambridge University Press, Cambridge, UK, 1989.

American Institute of Aeronautics and Astronautics


Table 1 Twin Otter Equation-Error Modeling Results

Parameter Estimate Std. Error

Cm_ (rad-1) -1.476 0.022

Cmq -36.35 0.69

Cm_e (rad-1) -1.869 0.020

Cmo 0.0023 0.0001

NASA Glenn Twin Otter

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::_;_;_2.

Fibre2 SIDPAC Data Channel Assignment GUI

American Institute of Aeronautics and Astronautics


ii__iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_ii

iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
Fibre3 £TDPAC Maneuver Length GUI

i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_ii___iiiiiiiiiiiiii

iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_iiiii!!iii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
........................................................... ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
_ __i_i_

i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
Fi__mre4 £TDPAC Translational Data Compatibility GUI

10

American Institute of Aeronautics and Astronautics


ii ii!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!i!iii!iiiiiiiiiiiiiiiiiiiiiiiii_
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_ii___iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii

',',i',i',i',i',i',i',i',i',i',i',i',i',i',i',i',i',_g,i',i',i',i',i_i',i_
......i......i"-,-_--ff ......i.....:_"--'i.....4:....._°' q__i__i__i__i__i__i__i__i__i__i__i__i__
-?-.....i ......i......t-)-'-:'_-i_:-i .....
i ......................
i i i---I
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_iii iiiiiiiiiiiii iiiiiiiii
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_iiiiiiiiiiii
:::::_ : :: :::::::
i:::::::::::::
:::::iiiiiiiiiiiii iiiiiiiiiii
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_iiiiiiiiii_iii iiiiiiii_iiiiiiiii!iii!i!iii!iii!i!iii!iiiii!iii!iiiii!iii!i!iii!iiiii!iii!iiiii!iii!i!i!i!_iiiiii

iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_iiii/
................
!...............
i...............
!................
!...............
ii_i_i_i_i_i_i_i_i_i_i_i_i_i_i_i_i_i_i_i_i_i_i_6_i_i_
i...............
!................
!...............
i..............
!................
...... "....... i ...... "....... "...... [...... i....... "....... _....... ".....
|iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_iiiiiiiiiiiiii_iii
: : = : : : : : : iiiiiiiiiiiiiiiiiiiiiii==i==i==i==i==i==i==i==i==i==i==i==i==i==i==i
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_iii_6iii_iii

iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiii
iiiiiii_iiiiiiiiliiiiiiiiiiiiiiiiiiiiiiiiiiiii

Fi_._re 5 £TDPAC Rotational Data Compatibility GUI

ii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_iiiiiiiiiiiiiiiiiiiiiiiiii_ii

iiiiiiiiiiiiiiiiiiiiiiii_
_i..............................
i..............................
i..............................
i...............................
i:::::::_:_:?:::i ...............................
i..........................
::i..............................
i......................
:::::iiiiiii_l___
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
', ', ', _.;._,.-,:-_-"_ ', 'h ', ', Im Flight I

?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:::?::
L ...... _ ...... J ...... "_g':'.'L .... L ...... [ _ _ _ _ _-_,... .... J ..... Model |::?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?:?::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
i:i:i:i:i:i:i:i:i:i:i:i:i:i:i:i:i:
_i:i:i:i:i@i:i ...... "___;_:'
', _f-" ...... ',"-; ..... ',"...... ;" ', ...... ',"--- ;---" 1 ....... ',"L; .... .___-
', .,_: _'_-_
£ ____________________________________________________________________________________________________iiiiiiiiiiiiiii:_
ii1811 1 i:i ii iii ii ii iii ii i:: :::: :::: : ::
...............................................................
r ' _ ....... '. _ ............................
_- :::::gi:,_i .............................................

iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_iiiiiiiiiiiiiiiiiiiiiiiiii_iiiiiiiiiiiiiiiiiiiiiiiiiiii_iiiiiiiiiiiiiiiiiiiiiiiiii_iiiiiiiiiiiii
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_iii iiiiiiiiiiiii iiiiiiiiii

iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_iiiiiiiiii_iii

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
_ _ _ _ _ _ _ _
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
.................................................................................................................................................................................................................................................................................................
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii',_',_',iii',_',_',iii
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiNiiiiii_iii_iii_iiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiii

SIDPAC Rotational Data Compatibility GUI with Instrumentation Corrections Applied

11

American Institute of Aeronautics and Astronautics


%
% script totter_demo.m
%
% Usage: totter_demo;
%
% Description:
%
% Demonstrates flight data analysis and modeling
% using SIDPAC for a longitudinal flight test maneuver
% on the NASA Glenn Twin Otter aircraft.
%
% Input:
%
% None
%
% Output:
%
% data file
% 2-D plots
%

%
% Calls:
% compfc.m
% compmc.m
% xsmep.m
% lesq.m
% r_colores.m
% model_disp.m
% swr. m
% zep.m
% tfest.m
% nldyn_psel.m
% oe.m
% nldyn.m
% m_colores.m
% plotpest.m
% tfsim.m
%
% Author: Eugene A. Morelli
%
% History:
% 11 Jul 2002 - Created and debugged, EAM.
%
% Copyright (C) 2002 Eugene A. Morelli
%
% This program carries no warranty, not even the implied
% warranty of merchantability or fitness for a particular purpose.
%
% Please email bug reports or suggestions for improvements to:
%
% [email protected]
%

%
% Load the data file.
%
load 'totter Ion 020213f1_018.mat'
%
% Set up the figure window.
%
FgH=figure('Units','normalized','Position',[.506.231 .504.715],...
'Name','SIDPAC Demonstration','N umberTitle','off,'Toolbar','none');
%
% Plot the measured inputs and outputs.
%
subplot(4,1,1), plot(t,fdata(:,14),'LineWidth',2),
title('Twin Otter Flight Test Data','FontWeight','bold'),
grid on, ylabel('elevator (deg)'),

Fibre 7 Twin Otter Data Analysis and Modeling Script (continued)

12

American Institute of Aeronautics and Astronautics


subplot(4,1,2), plot(t,fdata(:,4),'LineWidth',2),
grid on, ylabel('alpha (deg)'),
subplot(4,1,3), plot(t,fdata(:,6),'LineWidth',2),
grid on, ylabel('q (deg/sec)'),
subplot(4,1,4), plot(t,fdata(:,13),'LineWidth',2),
grid on, ylabel('az (g)'), xlabel('Time (sec)'),
fprintf('\n\n The figure shows the measured input and outputs.')
fprintf('\n\n Press any key to continue ... '),pause,
%
% Calculate aerodynamic force and moment coefficients.
%
fprintf('\n\n Calculate the non-dimensional ')
fprintf('\n aerodynamic force and moment ')
fprintf('\n coefficients using compfc.m and compmc.m:')
fprintf('\n\n [CX,CY,CZ,CD,CYw,CL]=compfc(fdata);')
fprintf('\n\n [CI,Cm,Cn]=compmc(fdata);')
[CX,CY,CZ,CD,CYw,CL]=compfc(fdata);
[CI,Cm,Cn,pv,qv,rv]=compmc(fdata);
subplot(2,1,1),plot(t,CZ,'LineWidth',2),grid on,ylabel('Z Force Coefficient'),
title('Non-Dimensional Coefficients from Flight Test Data','FontWeight','bold'),
subplot(2,1,2),plot(t,Cm,'LineWidth',2),grid on,ylabel('Pitching Moment Coefficient'),xlabel('Time (sec)'),
fprintf('\n\n Press any key to continue ... '),pause,
%
% Assemble the regressor matrix.
%
fprintf('\n\n Assemble the matrix of regressors ')
fprintf('_n for equation-error parameter estimation: ')
fprintf('\n\n alpha (rad)'),
fprintf('\n qhat '),
fprintf('\n elevator (rad)'),
X=[fdata(:,4)*pi/180,fdata(:,72),fdata(:,14)*pi/180];
%
% Plot the regressors.
%
subplot(3,1,1),plot(t,X(:,l),'LineWidth',2),grid on,ylabel('alpha (rad)'),
title('Eq uation-Error Regressors','FontWeig ht','bold'),
subplot(3,1,2),plot(t,X(:,2),'LineWidth',2),grid on,ylabel('qhat '),
subplot(3,1,3),plot(t,X(:,3),'LineWidth',2),grid on,ylabel('elevator (rad)'),
xlabel('Time (sec)'),
fprintf('\n\n Press any key to continue ... '),pause,
%
% Find smoothed trim values.
%
fprintf('\n\n Find the smoothed trim values ')
fprintf('\n from the regressors using xsmep.m:')
fprintf('\n\n X0=xsmep(X, 1.0,dt);')
X0=xsmep(X,1 ,dt);
%
% Plot the regressors and the smoothed trim values.
%
subplot(3,1,1),plot(t,X(:,l),'LineWidth',2),hold on,
title('Eq uation-Error Regressors','FontWeig ht','bold'),
plot(t(1),X(1,1),'r.','MarkerSize',14,'LineWidth',2), hold off,
grid on,ylabel('alpha (rad)'),
subplot(3,1,2),plot(t,X(:,2),'LineWidth',2), hold on,
plot(t(1),X(1,2),'r.','MarkerSize',14,'LineWidth',2), hold off,
grid on,ylabel('qhat '),
subplot(3,1,3),plot(t,X(:,3),'LineWidth',2), hold on,
plot(t(1),X(1,3),'r.','MarkerSize',14,'LineWidth',2), hold off,
grid on,ylabel('elevator (deg)'),xlabel('Time (sec)'),
%
% Remove the smoothed trim values.
%
fprintf('\n\n Remove the smoothed trim values ')
fprintf('\n from the regressors using :')
fprintf('\n\n X=X-ones(size(X, 1 ), 1 )*X0(1, :);')
X=X-ones(size(X,1),l)*X0(1,:);
%
% Program lesq.m requires a constant regressor for the bias term.
%

Fibre 7 Twin Otter Data Analysis and Modeling Script (continued)

13

American Institute of Aeronautics and Astronautics


X=[X,ones(size(X,1),l)];
fprintf('\n\n Press any key to continue ... '),pause,
%
% Linear regression for the Z force coefficient.
%
fprintf('\n\n Z force coefficient:')
fprintf('\n_n Estimate stability and control ')
fprintf('\n derivatives using equation-error ')
fprintf('\n linear regression program lesq.m: ')
fprintf('\n\n [yZ,pZ,crbZ,s2Z]=lesq (X,CZ);')
[yZ,pZ,crbZ,s2Z]=lesq(X,CZ);
%
% Plot the results.
%
subplot(2,1,1),plot(t,CZ,t,yZ,'r:','LineWidth',2),grid on,
title('Equation-Error Parameter Estimation','FontWeight','bold'),
ylabel('CZ'),legend('Flight data','Regression model',0),
subplot(2,1,2),plot(t,CZ-yZ,'LineWidth',l .5),grid on,
ylabel('Residuar),xlabel('Time (sec)'),
%
% Compute and display the error bounds.
%
fprintf('\n\n Compute the estimated parameter ')
fprintf('\n error bounds using r_colores.m: ')
fprintf('\n\n [crbZ,crboZ]=r_colores(X,CZ); ')
[crbZ,crboZ]=r_colores(X,CZ);
serroZ=sqrt(diag (crboZ));
serrZ=sqrt(diag(crbZ));
perrZ=100*serrZ./abs(pZ);
fprintf('\n\n Display the parameter estimation ')
fprintf('\n results using model_disp.m:')
Xlab=['alpha (rad) ';'qhat ';'elevator (rad)'];
model_disp(pZ,serrZ,[1,10,100,0],Xlab);
fprintf('\n\n Press any key to continue ... '),pause,
%
% Stepwise regression for the pitching moment coefficient.
%
fprintf('\n_n Pitching moment coefficient: ')
fprintf('\n\n Add a nonlinear cross term alpha*elevator ,')
fprintf('\n regressor and use stepwise regression program swr.m:')
fprintf('\n\n [ym,pm,crbm,s2m]=swr(X,Cm);')
%
% Program swr.m adds the bias term automatically,
% so the constant regressor is not necessary. Add
% the nonlinear cross term to the regressor matrix X.
%
X=[X(:,[1:3]),X(:, 1).*X(:,3)];
[ym,pm,crbm,s2m,Xm,pindxm]=swr(X,Cm, 1);
%
% Include only parameters for selected regressors.
%
pm=pm(pindxm);
%
% Plot the results.
%
subplot(2,1,1),plot(t,Cm,t,ym,'r:','LineWidth',l .5),grid on,
title('Pitching Moment Coefficient','FontWeight','bold'),
ylabel('Cm'),legend('Flight data','Equation-Error model')
subplot(2,1,2),plot(t,Cm-ym,'LineWidth',l .5),grid on,
ylabel('Residuar),xlabel('Time (sec)'),
%
% Compute and display the error bounds.
%
fprintf('\n\n Compute the estimated parameter ')
fprintf('\n error bounds using r_colores.m: ')
fprintf('\n\n [crbm,crbom]=r_colores(X,Cm); ')
[crbm,crbom]=r_colores(Xm,Cm);
serrom=sqrt(diag (crbom));
serrm=sqrt(diag(crbm));
perrm=100*serrm./abs(pm);

Fibre 7 Twin Otter Data Analysis and Modeling Script (continued)

14

American Institute of Aeronautics and Astronautics


fprintf('\n\n Display the parameter estimation ')
fprintf('\n results using model_disp.m:')
model_disp(pm,serrm,[1,10,100,0],Xlab);
fprintf('\n\n Press any key to continue ... '),pause,
%
% Estimate the transfer function model q/de.
%
fprintf('\n\n Estimate the transfer function ')
fprintf('\n for pitch rate to elevator deflection ')
fprintf('\n (q/de), using tfest.m:')
fprintf('\n\n [ytf, num,den,ptf,crbtf,s2tf,zr,xr,f] = tfest(u,z,t,1,2,w);')
fprintf('\n\n The frequency vector is w = 2"pi*[0.3:.01:1.3]".')
w=2*pi*[0.3:.01:1.3]';
%
% Detrend the time domain data for frequency domain analysis.
%
u=zep(fdata(:,14));
z=zep(fdata(:,6));
subplot(2,1,1),plot(t,u,'LineWidth',2),grid on,
title('Transfer Function Modeling Data','FontWeight','bold'),
ylabel('Elevator (deg)'),
subplot(2,1,2),plot(t,z,'LineWidth',2),grid on,
ylabel('Pitch Rate (deg/sec)'),xlabel('Time (sec)'),
fprintf('\n\n Press any key to continue ... '),pause,
[ytf,num,den,ptf,crbtf,s2tf,zr,xr,f] = tfest(u,z,t,1,2,w);
subplot(2,1,1),plot(f,abs(zr),f,abs(xr*ptf),'r:','LineWidth',l .5),grid on,
title('Frequency Domain Transfer Function Modeling','FontWeight','bold'),
ylabel('Magnitude'),legend('Flight data','Transfer function model')
subplot(2,1,2),plot(f, unwrap(angle(zr)),f,unwrap(angle(xr*ptf)),'r:','LineWidth',l .5),grid on,
ylabel('Phase'),xlabel('Frequency (Hz)'),
fprintf('\n'),tf(num,den),
fprintf('\n\n The figure shows the frequency domain fit. ')
fprintf('\n\n Identified modes from the transfer function ')
fprintf('\n identification in the frequency domain are: \n')
damp(den),
fprintf('\n\n Press any key to continue ... '),pause,
subplot(2,1,1),plot(t,z,t,ytf,'r:','LineWidth',l .5),grid on,
title('Equation-Error Frequency Domain Transfer Function Modeling','FontWeight','bold'),
ylabel('Pitch Rate (deg/sec)'),legend('Flight data','Transfer function model')
subplot(2,1,2),plot(t,z-ytf,'LineWidth',2),grid on,
ylabel('Residuar),xlabel('Time (sec)'),
fprintf('\n\n The figure now shows the time domain fit. ')
fprintf('\n\n Press any key to continue ... '),pause,
%
% Estimate the dimensional stability and control derivatives
% using time-domain output-error parameter estimation.
%
fprintf('\n\n\n Now estimate the non-dimensional stability ')
fprintf('\n and control derivatives using output-error ')
fprintf('\n parameter estimation in the time domain.')
fprintf('\n\n Input: elevator (rad)')
fprintf('\n Outputs: alpha (rad), q (rad/sec), az (g)')
dtr=pi/180;
u=fdata(:,[14:16])*dtr;
z=[fdata(:,[4,6])*dtr,fdata(:, 13)];
%
% Plot the measured inputs and outputs.
%
subplot(4,1,1), plot(t,u(:,l),'LineWidth',2),
title('Output-Error Time Domain Modeling','FontWeight','bold'),
grid on, ylabel('elevator (rad)'),
subplot(4,1,2), plot(t,z(:,l),'LineWidth',2),
grid on, ylabel('alpha (rad)'),
subplot(4,1,3), plot(t,z(:,2),'LineWidth',2),
grid on, ylabel('q (rad/sec)'),
subplot(4,1,4), plot(t,z(:,3),'LineWidth',2),
grid on, ylabel('az (g)'), xlabel('Time (sec)'),
fprintf('\n\n The figure shows the measured input and outputs.')

Fibre 7 Twin Otter Data Analysis and Modeling Script (continued)

15

American Institute of Aeronautics and Astronautics


%
% Set up for the output-error parameter estimation using
% nldyn.m to define the dynamic model.
%
nldyn_psel;
fprintf('\n\n Press any key to continue ... '),pause,
%
% Find initial parameter values for the
% output-error parameter estimation.
%
fprintf('\n\n Initial values of the parameters in ')
fprintf('\n vector p0 are obtained from the ')
fprintf('\n equation-error solution:\n')
%
% Omit the CZq term in the output-error formulation,
% because of low sensitivity at low angles of attack.
%
p0=[pZ([1,3,4]);pm],
serrO=[serrZ([1,3,4]);serrm];
fprintf('\n\n Estimate the model parameters ')
fprintf('\n using output-error parameter estimation ')
fprintf('\n program oe.m and dynamic model file nldyn.m: ')
fprintf('\n\n [y,p,crb,rr]=oe("nldyn",p0,u,t,x0,cc,z);')
fprintf('\n\n Press any key to continue ... '),pause,
fprintf('\n\n Starting oe.m ...')
tic,[y,p,crb,rr]=oe('nldyn',p0,u,t,x0,cc,z);toc,
%
% Plot the results.
%
clf, title('Output-Error Parameter Estimation','FontWeight','bold'),
subplot(3,1,1),plot(t,z(:,l),t,y(:,l),'r:','LineWidth',2),grid on,ylabel('alpha (rad)'),
legend('Flight data','Output-Error model',0),
subplot(3,1,2),plot(t,z(:,2),t,y(:,2),'r:','LineWidth',2),grid on,ylabel('q (rad/sec)'),
subplot(3,1,3),plot(t,z(:,3),t,y(:,3),'r:','LineWidth',2),grid on,ylabel('az (g)'),xlabel('Time (sec)'),
fprintf('\n The plots show the measured output data ')
fprintf('\n and the identified model fit. ')
fprintf('\n\n Press any key to continue ... '),pause,
%
% Examine the residuals.
%
clf, subplot(3,1,1),plot(t,z(:,l)-y(:,l),'LineWidth',2),grid on;ylabel('alpha residuals (rad)'),
title('Residuals','FontSize', 12,'FontWeight','bold'),
subplot(3,1,2),plot(t,z(:,2)-y(:,2),'LineWidth',2),grid on;ylabel('q residuals (rad/sec)'),
subplot(3,1,3),plot(t,z(:,3)-y(:,3),'LineWidth',2),grid on;ylabel('az residuals (g)'),xlabel('Time (sec)'),
%
% Correct the estimated parameter error bounds.
%
fprintf('\n\n The output residuals are colored ')
fprintf('\n (due to modeling error), so the ')
fprintf('\n Cramer-Rao bounds calculated by oe.m must ')
fprintf('\n be corrected for colored residuals using ')
fprintf('\n program m_colores.m:')
fprintf('\n\n [crb,crbo] = m_colores("nldyn",p,u,t,x0,c,z);')
fprintf('\n\n Press any key to continue ... '),pause,
fprintf('\n\n Starting m_colores.m ..._n\n')
tic,[crb,crbo] = m_colores('nldyn',p,u,t,x0,cc,z);toc,
serr=sqrt(diag(crb));
%
% Display the parameter estimation results.
%
model_d isp(p ,serr,[1,100,0,1,10,100,0] ,Xlab);
leglab=['Eq uation-E rror';'Output-E rror '];
parlab=['CZ_alpha';'CZ_de ';'CZ_o "
'Cm_alpha';'Cm_q ';'Cm_de ';'Cm o '];
indx=[4,6]';
p__tpest([p_(indx)_p(indx)]_[serr_(indx)_serr(indx)]_[]_[]_par_ab(indx_:)__eg_ab);
title('Parameter Estimation Results','FontWeight','bold')
fprintf('\n\n The figure shows that the equation-error ')
fprintf('\n and output-error parameter estimates are ')
fprintf('\n in statistical agreement. ')

Fibre 7 Twin Otter Data Analysis and Modeling Script (continued)

16

American Institute of Aeronautics and Astronautics


fprintf('\n\n Press any key to continue ... '),pause,
save 'totter_results.mat' num den p serr p0 serrO pZ serrZ pm serrm cc dtr;
%
% Check the prediction capability.
%
load 'totter Ion 020213f1_017.mat'
fprintf('\n_n Now check the prediction capability ')
fprintf('\n using data from a different maneuver ')
fprintf('\n and the identified transfer function ')
fprintf('\n model from before:')
fprintf('\n'),tf(num,den),
u=fdata(:,14); u=zep(u);
z=fdata(:,6); z=zep(z);
ytfp=tfsim(num,den,0,u,t);
%
% Plot the transfer function prediction results.
%
subplot(2,1,1),plot(t,z,t,ytfp,'r:','LineWidth',2),grid on,
title('Transfer Function Prediction','FontWeight','bold'),
ylabel('Pitch Rate (deg/sec)'),legend('Flight data','Transfer function prediction',4)
subplot(2,1,2),plot(t,z-ytfp,'LineWidth',2),grid on,
ylabel('Residuar),xlabel('Time (sec)'),
fprintf('\n\n The figure shows the time domain prediction ')
fprintf('\n using the transfer function model identified ')
fprintf('\n using data from a different maneuver. ')
fprintf('\n\n Press any key to continue ... '),pause,
u=fdata(:,[14:16])*dtr;
z=[fdata(:,[4,6])*dtr,fdata(:, 13)];
nldyn_psel;
yp=nldyn(p,u,t,x0,cc);
%
% Plot the measured inputs and outputs.
%
subplot(4,1,1), plot(t,u(:,l),'LineWidth',2),
title('Twin Otter Flight Test Data','FontWeight','bold'),
grid on, ylabel('elevator (rad)'),
subplot(4,1,2), plot(t,z(:,l),'LineWidth',2),
grid on, ylabel('alpha (rad)'),
subplot(4,1,3), plot(t,z(:,2),'LineWidth',2),
grid on, ylabel('q (rad/sec)'),
subplot(4,1,4), plot(t,z(:,3),'LineWidth',2),
grid on, ylabel('az (g)'), xlabel('Time (sec)'),
fprintf('\n\n\n The figure shows the measured input and outputs ')
fprintf('\n for the prediction maneuver. ')
fprintf('\n\n Press any key to continue ... '),pause,
%
% Plot the output-error prediction results.
%
title('Output-Error Prediction','FontWeig ht','bold'),
%
% Correct for measurement biases.
%
bias=ones(length(t),l)\(z-yp);
yp=yp+ones(length(t),l)*bias;
subplot(3,1,1),plot(t,z(:,l)/dtr,t,yp(:,l)/dtr,'r:','LineWidth',2),grid on,ylabel('alpha (rad)'),
legend('Flight data','Output-Error prediction',4),
title('Output-Error Model Prediction','FontWeight','bold'),
subplot(3,1,2),plot(t,z(:,2)/dtr,t,yp(:,2)/dtr,'r:','LineWidth',2),grid on,ylabel('q (rad/sec)'),
subplot(3,1,3),plot(t,z(:,3),t,yp(:,3),'r:','LineWidth',2),grid on,ylabel('az (g)'),xlabel('Time (sec)'),
fprintf('\n The plots show the measured output data ')
fprintf('\n and the prediction using the output-error ')
fprintf('\n model identified using data from a different ')
fprintf('\n maneuver. ')
fprintf('\n\n\nEnd of demonstration \n\n')
return

Fi_._ure 7 Twin Otter Data Analysis and Modeling Script (complete)

17

American Institute of Aeronautics and Astronautics


i_ii !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
®iiii
i iiiiiiiiii iiiiiiiiiiiiii iiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
i_iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii

i_iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii_iiiiiiii_i_iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii

Fibre 8 Twin Otter Pitching Moment Coefficient Modeling

18

American Institute of Aeronautics and Astronautics

You might also like