SlideShare a Scribd company logo
1 of 20
Download to read offline
Contents
Contents................................................................................................................................................ 1
1 Parameter Estimation Basics............................................................................................................ 2
1.1 Concept Summary................................................................................................................... 2
2 – Getting Started ................................................................................................................................. 2
2.1 the Run object......................................................................................................................... 2
2.1.1 Run object definition ........................................................................................................ 2
2.2 Equations and Constants................................................................................................................ 7
2.2.1 Observation Equations...................................................................................................... 7
2.2.2 State Equations ................................................................................................................ 7
2.3 Defining parameters ................................................................................................................ 8
2.4 Tools Directory ........................................................................................................................ 8
2.5 Starting the run ....................................................................................................................... 8
2.5.1 Pre-processing.................................................................................................................. 8
2.5.2 Simulation........................................................................................................................ 9
3 Output Error Method......................................................................................................................10
3.1 Introduction...........................................................................................................................10
3.2.1 Coding Procedure:...........................................................................................................11
3.2.2 Additional Calculations ....................................................................................................12
3.3 Post-processing......................................................................................................................13
4 Filter Error Method ........................................................................................................................13
4.1 Introduction...........................................................................................................................13
4.2 Coding procedure ...................................................................................................................14
5 BifurcationAnalysis........................................................................................................................15
5.1 Introduction...........................................................................................................................15
5.2 MATCONT..............................................................................................................................15
5.2.1 Equilibrium......................................................................................................................15
5.2.2 Limit Cycle.......................................................................................................................17
Appendix...............................................................................................................................................18
A1 State Space Formulation – 1DOF..............................................................................................18
A2 Administering trails and tests ..................................................................................................18
A4 Definitions..............................................................................................................................19
References............................................................................................................................................20
Introduction
This document will guidethe user through a complete run of a Numerical Simulation,Output Error Parameter
Estimation,and a Continuation procedure of an aircraftconstrained in 1 Degree of Freedom (1DOF), usingan
experiment undertaken in the University of Bristol as an example.This packagecan be modified with ease to use other
estimation methods (Equation Error and Filter Error),and can be applied widely given experimental data and a
numerical model of the experiment exists.J.Pattinson holds creditfor adaptingthis code from the supplements in [1],
for use in his thesis [3].As partof a project undertaken in 2015, the author used this code for further analysisof the
same problem, but found many difficultiesin runningitin the same way. This document was written to help the user
understand how the theoretical practices of Parameter Estimation discussed in many documents are implemented
usingMATLAB, and how the individual parts interactwith each other to come to the correct output. The aimis
provideaccess to toolbox to aideany work wantingto utilizethese methods without prior experience of codingthem.
1 Parameter EstimationBasics
1.1 Concept Summary
The concept of Parameter Estimation is relatively easy to grasp.The analogy to linear regression is thefirstplace
someone strugglingto understand itshould turn – when two curves of discretedata points existin the same domain,
the β€˜lineof best fit’ between them falls where the sum of their differences is minimized.This is commonly known as
β€˜leastsquares’regression and is a well-known foundation of optimisation.Equation Error parameter estimation is
exactly likethis.One of the discretecurves is experimental data measured under controlled conditions,and the other
is a simulation of the same experiment numerically.The numerical curveis created by integratinga set of differential
equations (A1) and evaluatingthem at each time point of the experiment; the conditions in theequations will affect
the response to the independent variablebeingchanged in the test. The aimof Parameter Estimation is to find the
lineof best fit, and this is achieved by manipulating these conditions,or parameters (1), until the error between the
simulated and experimental curves is minimised.The parameters found for the minimized condition will describethe
real-world model, dependant on the accuracy of the differential equations.A detailed description of the equations
and parameters used in this example can be found in [2]
𝛩 = [𝐢 𝐿 𝛼 𝑀
, 𝐢 𝐿 π›Όβ„Ž
, 𝛼0 𝑀
, πœ€ 𝐢 𝐿
, 𝐢 𝑀 π‘ž 𝑀
, π‘Ž1, 𝜏1, 𝜏2, π›Όβˆ—
, 𝐢 𝐿 π‘œπ‘“π‘“π‘ π‘’π‘‘
]
2 Getting Started
2.1 the Run object
Object Orientated Programming (OOP) is a styleof computer programmingwhereby the programmer uses the
concept of objects,structures containingdata fields and procedures,to simplify the management of complex
software. In MATLAB, objects come in classes with properties (data fields) and methods (procedures) to control
multiplefunctions and scripts fromone control. The applicationsof OOP are richly spread and numerous,but for this
specific code,the use of an object can be seen as the centre of a branch diagram,providingthe necessary data for all
functions involved in the programme. This approach increasesthe flexibility of the code to encompass different
experimental scenarios with ease,which makes for a much more user friendly experience. [9]
The run object only uses its properties field to feed into the many functions that encompass the programme. Rather
than changingthese fields individually in each script,the run object will providethat information globally,extending
the use beyond the specified function.The object properties can be edited locally and kept for use in temporary
storage, but caremust be taken to clear the object edited fields before each run to revert the object back to its
original conditions.The β€˜clear all’function can do this.
2.1.1 Run object definition
The next 4 pages explain the purpose and format of each entry in the run object file. Before startingany run, every
property should be doublechecked againstthe description.
(1)
Property Value Description Flag File Reference
state_equations 'xdot_TC13_1DOF_pitch_no_frict' The .m fileresponsiblefor the state equations β€˜X’ in equation 2
being called every time a simulation is required to run or a
state evaluated.
#1,2 -
observation_equations β€˜obs_TC13_1DOF_pitch’ The .m fileresponsiblefor processingthesimulated data for
the observation variableβ€˜Y’ in equation 2. This is processed
immediately after the state equations to providethe output
comparison to the experimental data
#1,2 -
num_of_states 4 The .m fileresponsiblefor processingthesimulated data for
the observation variableβ€˜Y’ in equation 2. This is processed
immediately after the state equations to providethe output
comparison to the experimental data
- -
num_of_observables 2 This valueshould be consistentwith the number of entries in
the 1xn state equation fileoutput. This must match for the
parameter fileto be generated correctly.
- -
num_of_inputs β€˜4’ This valueshould match the number of inputs in the matrix
used to utilisethe OEM’s capability to model noise. In this
case,each inputcorrelates to a measured experimental
quantity.
#2 -
num_of_parameters β€˜11’ This number should match the number of parameters that the
optimiser will recogniseand process in the Output Error
Method. Be careful in recognisingwhich variables thecode
views as parameters.
#2 -
run_type β€˜1DOF_pitch_only’ This code will tolerateexperiments in 1DOF pitch or 2DOF
pitch and heave. More types can be added but for the
purposes of this code, the two options are β€˜1DOF_pitch_only’
and β€˜2DOF_pitch_and_heave’.
#2 -
rig_config β€˜1’ Retain valueof 1 for calculation of the riginfluenceon the
model.
#2 preprocess_data
preprocessing_flags β€˜1’ Enables the inclusion of servo data in the main data matrix #2 preprocess_data
filter_span β€˜3’ The window half width used for differentiatingthe values of
tunnel velocity usingan inverseTaylor Series approach.
Nominally setas 3 but play around to get the best results.
#2 preprocess_data
Property Value Description Flag File Reference
filter_order β€˜2’ The order of the derivativeapproximation made – this can be
bigger than what you want out, so set as 2 for a firstorder
differential likedVt.
#2 preprocess_data
method β€˜OEM’ Decision of which approach to take for the Parameter
Estimation partof the code. A choiceof EEM, OEM, or FEM.
#2 Define_case
method_opt β€˜OEM_GN’ Controls which optimisation method will be undertaken:
Gauss-Newton or Levenberg-Marquardt. A choiceof OEM_GN,
OEM_LM, EEM_LM, OEM_GN, EEM_GN
#2 Define_case
line_search 1 Used to inducethe linesearch function in the Gauss Newton
optimisation procedureto optimisein a certain direction.
- Define_case
run_start_time {340} The startingtime of the numerical simulation.Used in
graphingfor experimental comparison and normalised during
the simulation.
#3 Define_case
run_end_time {400} The ending time of the numerical simulation.Same uses as
above.
#3 Define_case
data_from_file {'090622_20ms_1dof_ramp_part
2_processed'}
This property calls theresults filethatmay or may not exist
depending on previous runs of the samefile. The user can
define any name for this filebut for convenience the same
name as the core experimental data filehas been used.
#1,2,3 Define_case
nzi β€˜1’ The number of time segments (or data files) used in the
processing.The requirement to use sequential data files is not
uncommon, but will takea longer time, so limitingto two large
files would be sensible.
#2 Define_case
exp_obs_data_index {'theta_a', 'dtheta_a'} This singularmatrix defines which variables in thechosen
β€˜BigMat’ data filethat the estimation tool will takeas the
observation variables.
#2,3 Define_case
exp_inp_data_index {'hawk_servo1','Vt','qbar','dVt'} This singularmatrix defines which variables in thechosen
β€˜BigMat’ data filethat the estimation tool will takeas the input
variables.These will bemeasured experimental values.
#2,3 Define_case
Property Value Description Flag File Reference
compute_x0 1 This programme has the capability of definingthe initial
conditions for each of the states simply by referencing the
BigMat data fileat the initial timepoint specified in
Define_case. If the user does not want these values or they are
not producinga good output, select β€˜0’ and create the x0
matrix yourself,ensure the dimensions and orientation arethe
same.
- Define_case
directly_obs_states [1,1] This matrix triggers the use of the observation variable
generated in the simulation for usein further processing.The
matrix must be the same dimension as the observation
variableβ€˜Y’. The entries match up with the entries in this
variable.Avalueof 0 will mask the chosen entry. For most
purposes,this should always bepopulated with ones.
#4 Define_case
params_from_csv_or_
mat
β€˜csv’ The parametervaluesatthe starting,latestandsaved
pointswill be recordedintoafile,whichMATLABwill
processintoa csv (commaseparatedvalues) ora mat
(MATLAB matrix) file.The choice of whichwill be
specifiedhere.Choosingcsvmakesediting andviewing
simpler,butcallingsimplicitywouldfavouramat file.
#2 load_and_check_parameters
results_file β€˜090622_20ms_1dof_ramp_part2
_processed’
This stringdefines the name of the results filethe final
parameters postestimation are output to. Can be any name
but for ease of trackingthe same name as the input fileis used
throughout.
#2 load_and_check_parameters
which_parameters β€˜start’ This stringwill decidewhether the starting,latestor saved
parameters saved in the parameter csv/matfile are used in
the latestrun of the state equations.Start, latestor saved.
#2 load_and_check_parameters
obs_plot_mask [1,1] A valueof 0 in these entries masks the plotting of the
observation variablein question.Matrix must be consistent
with the sizeof the observation variablematrix.
#4 plot_output
inp_plot_mask [1,1,1,1] A valueof 0 in these entries masks the plotting of the input
variablein question.Matrix mustbe consistentwith the sizeof
the input variablematrix β€˜Uinp’.
#4 plot_output
Property Value Description Flag File Reference
static_type β€˜ramp_lin’ This property should be defined accordingto the type of linear
progression the input takes. This is for setting up the function
that trims the inputto help the user match the output after
one iteration.A constantinitial condition (X0),a singlepoint
(single) or a linear ramp (ramp_lin) arethe options.
#2 generate_trim_points
ramp input [1] Verify input of a ramp type #4 generate_trim_points
trim_switch 4 Decision outof 1, 2, 3 or 4 of which trim path to take. This
property is related to input type and is described in the
function.
- generate_trim_points
velocity_states 0 The number of velocity states in the trim input – set to zero - generate_trim_points
generate_static_file 1 1 to generate a new fileof static points,0 to ignore. - generate_trim_points
static_file 'TC_13_static_results' Name of static fileif decided to create one #2 generate_trim_points
input_delay_mask β€˜nomask’ This property defines whether or not a delay is required in the
input file.If this property is a number (1), the function will
generate a delay and rewrite the Uinp variable.If itis a string
(mask), the delay creation will bemasked.
#2 compute_cost
parameter_step_function 1e-3 This property will control the sizeof step taken when varying
the parameters in each iteration.
- oem_func
convergence_tolerance 1e-3 This property will definethe limitof accuracy the optimiser
will takebetween trails until a solution isreached that has a
difference of less than this value
- oem_func
num_iterations 1 This property defines the number of Parameter Estimation
iterations taken. Each iteration will takethe new parameters
estimated from the previous iteration and use them as the
new X0. For a full run of the current experiment (600 seconds),
more than one iteration will takea very long time (1hr+).
- oem_func
Flags
#1 - full filename without the .m
#2 - stringtype therefore insidequotation marks for compatibility
#3 - singularmatrix definition required therefore includecurly brackets for compatibility
#4 - singularmatrix numeric definition required therefore includesquarebrackets for compatibility
2.2 Equations and Constants
The equations required for numerical simulation should beheld in two files – the state equations and the observation
equations,and should be kept in the >Models directory. Wihin these files however, as many functions and constants
can be called as desired,in accordancewith how the user wants the simulation to run.
2.2.1 Observation Equations
As an example, obs_TC13_1DOF_pitch outputs the observation variableYgiven an input from the state integration of
(2). This output is used in the cost function to directly compareagainstthe experimental data, and is simply an
augmentation of rigpitch and pitch rate. Table 1 shows the MATLAB requirements for the function.
Inputs time Β¦ state Β¦ inputs Β¦ parameters
Outputs Y (observation vector)
Table 1 –list ofinput and outputs ofthe observation equations function
2.2.2 State Equations
xdot_TC13_1DOF_pitch_no_frict outputs a state vector of values thatare integrated to form the numerical simulation,
and are slightly lessflexiblein terms of format. For the integration to work, the inputs must includetime previous
state values inputvariables for each time step and a vector of parameters .This vector of parameter s is importantto
define correctly. An efficiency of this programme is its useof a singleequations filefor each operation- integration,
estimation and continuation.The estimation segment requires categorisation of the parameters in order to optimise
them, whereas the other operations do not, so the parameters aredefined as variables in stages 6 and 7, and
constants for the remainingoperations.Table 2 shows the MATLAB requirements for the function.
Note: the equations must be written in state space form (A1).
π‘Œ = 𝑋(πœƒ)
Inputs time Β¦ state Β¦ inputs Β¦ parameters
Outputs xdot (state vector)
Table 2-list ofinputandoutputs ofthe state equations function
The firstlines of the state equations file(figure 1) should define the function inputs as variablesin the equation:
ο‚· States should correspond to the β€˜x’ input: a [n,d] matrix,where n=run.num_of_states and d=length(data file)
– the number of discrete data points.
ο‚· Equation inputs can come from any number of variables in thefunction definition;however itis easier to
manage a singlevector usually labelled β€˜u’.
ο‚· The constants of calculation (Centre of Gravity position,rigmoments of inertia etc.) are externally derived –
they are kept in a singlefilefor global applicability.For the purposes of Pattinsons experiments, the constants
come from the wind tunnel rigand test model – a Bae Hawk, therefore the >Hawk and >Rig directories hold
the information files related to each element of the experiment. hawk_constants is a function that when
(2)
Figure 1-first lines ofstate equations used for input definition
called in any function will outputonly the constants required for the specified analysis type,ensuringthe size
of the constants matrix will alwaysbe compliantwith what is required of it. All constants should bechanged
in this file.
2.3 Defining parameters
The parameter definition is littlemoreinvolved and easy to do wrong, however the steps are simple.
1. Locate the equation filethat includes the useof any estimation parameters. This may be the straightstate
equation file,or itmay be a nested function insideof here – in test case 13, the nested function
Hawk_2DOF_M05 is responsiblefor the core physical calculations(the xdot files simply preparethe states for
processingin this file).
2. Create a _spec filewith the same filename (i.e. Hawk_2DOF_M05_spec.m), followingthe same format as the
current _spec files.
3. Create enclosed strings with entries exactly the same as the variablenames described in hawk_estimates.
The _spec filewill usethis stringto call the β€˜estimates’ matrix created in hawk_estimates, and then create a
new matrix based on the findingof matching strings,populated with the numeric values associated with
those entries. This matrix becomes part of the results filewhich stores the initial values in theestimates file,
then updates once new values arefound from the estimation process.
4. Save files,then define each correspondingvariablein the nested function file as param(n),where
n=run.num_of_parameters. The vector β€˜param’ will automatically become the dimensions of n and be
populated with the initial estimates.
2.4 Tools Directory
The >Tools directory holds the majority of the functions spread out over the programme. This should be the first
reference when tryingto locatea function. The only other options are the >Matlab_tools and the
>Output_error_method directories for general arithmetic OEM specific functions.
2.5 Starting the run
Once the properties in the runA object are defined, the programme needs to be started. The programme is builtup in
stages, to enable individual sectionsto be run and reduce run times. The PE_control file(table 3) holds all the function
callsfor each stage, and includes an inputhandlethat callseach stage.To run a stage, a separatefilemust be created
that runs the PE_control function.This has been called β€˜run_TC13’ in the examples.Highlightingeach command (i),
rightclicking,and selecting Evaluate Section will run a singlestageonly.
π‘Ÿπ‘’π‘› = 𝑃𝐸_π‘π‘œπ‘›π‘‘π‘Ÿπ‘œπ‘™ (π‘Ÿπ‘’π‘›π΄, π‘₯, π‘₯, 𝑛)
Stage Description
1-3 Pre-processing
4/5 Plottingand costfunction calculation
6/7 Parameter Estimation steps
8-22 Plottingand post-processing
22-26 Continuation and plotting
Table 3- summary ofthe operations included in PE_control
2.5.1 Pre-processing
add_remove_paths - MATLAB requires information of where each individual fileis stored to be ableto access it:this
allows theuser to logically createfolders and avoid singlefolders with huge numbers of files.The function
add_remove_paths will do this automatically given a description of each folder location.This will need to be changed
for each new use of the programme. An inputof β€˜1’ will add the files,whereas an input of β€˜-1’ will remove them from
the path. You can check the paths MATLAB is awareof by selecting Home>Set Path.
(i)
Figure 2-toolbar choices for accessing the MATLAB path
Pre_process -The raw data in the experimental files needs to be processed into a singlematrix of values for global use.
Upon loading,the BigMat matrix holds all of this data,with the BigMat_names (table4) cell separately definingeach
column. Raw data is kept in the >Experimental_data directory. Any additional files of this type should be stored here.
1 2 3 4 5 6 7 8 9 10
time rig_roll rig_pitch rig_yaw model_
pitch
model_
yaw
encoder0 encoder1 encoder 2 encoder3
11 12 13 14 15 16 17 18 19 20
comp_
servo0
comp_
servo1
comp_
servo2
comp_
servo3
hawk_
servo0
hawk_
servo1
hawk_
servo2
hawk_
servo3
hawk_
servo4
Vt
21 22 23 24 25 26 27 28 29 30
qbar hawk_
servomdl0
hawk
servomdl1
hawk_
servomdl2
hawk_
servomdl3
hawk_
servomdl4
Vt_smooth dVt encoder0_
smooth
encoder1_
smooth
31 32 33 34 35 36 37 38 39 40
encoder2_
smooth
encoder3_
smooth
theta_a dtheta_a ddtheta_a hawk_de hawk_den alpha_a dalpha_a M_a
Table 4 –BigMatnames matrix corresponding to the example only
The pre-processor includes calculation of wind angles and riginfluence,producingthe last8 columns in the matrix.
generate_parameter_file - The parameter fileto hold the initial,latestand saved parameters must be generated for
use in the estimation segment. The output is a .csv or .mat filethat can be viewed in the >Results_new directory.An
extra set of rows is added to the parameter vector β€˜param’ which are populated by the initial conditionsβ€˜X0’,a vector
of length [n,1] where n=run.num_of_states.
Define_case - This fileis critical to the overall operation of the programme: every variablethe test casecould need is
set up in this fileand saved to a local workspaceinsidethe routine. This workspaceis notvisibleif runningthe
programme directly from PE_control, therefore this function must be run alonebefore any trailsor tests can be
administered (A2). The function is splitinto segments to alloweasier trackingof the variables beinggenerated. β€˜X0’,
the initial conditions (IC’s) of the states can be evaluated and stored here if run.compute_x0 returns 1. If the
computed IC’s areunsatisfactory,an independent matrix can be written here.
2.5.2 Simulation
The firstphaseof the processingpartof the code is to compute the value of the primary costfunction,done so from
the compute_cost_and_plot function. The function call path is as below:
compute_cost – firstchecks whether a simulation already exists,then concatenates the system parameters and initial
conditions into one vector, providingan inputto costfun_oem. The simulation check is doneso that a lengthy repeat
of the simulation is notrequired when the optimiser attempts to run one again.
costfun_oem – runs a time integration using run_sim as the function controllingtheintegrator. Once this is complete,
the covariancematrix R(3) (the maximum likelihood estimateof the output errors) is calculated, and then the
determinant of its diagonal evaluated to give the value of the current costfunction (4).
𝑅 =
1
𝑁
βˆ‘ [ 𝑧( 𝑑 π‘˜
) βˆ’ 𝑦( 𝑑 π‘˜
)][𝑧( 𝑑 π‘˜
) βˆ’ 𝑦( 𝑑 π‘˜
)] 𝑇𝑁
π‘˜=1
𝐽( 𝛩, 𝑅) =
1
2
βˆ‘ [𝑧( 𝑑 π‘˜
) βˆ’ 𝑦(𝑑 π‘˜
𝑁
π‘˜=1 )] 𝑇
π‘…βˆ’1
[𝑧( 𝑑 π‘˜
) βˆ’ 𝑦( 𝑑 π‘˜
)]
run_sim – this function controls the integration step, processes the results through the observation equations and
outputs this as a singlevariable Y(figure 4). The options associated with the ODE solver aredeclared here, as well as
the global variablesinsidethe state equations for storingthe evaluated values of state (A3).
(3)
(4)
Figure 3 –function structure within compute cost and plot
ode15s – is a standard MATLAB ODE solver for stiff differential equations.The output xs is a matrix of state solutions
with length equal to the number of discrete data points.The β€˜options’ values should beclosely checked to ensure the
time induces the samenumber of points. This solver is variablestep,which dramatically affects the outcome when a
time delayed inputis involved (A3).
ODE solver format – the common format exercised in all MATLAB solvers is as follows [11]:
options = odeset (β€˜option_choices’)
[time_points, state_solution] = solver (@equationhandle, time_vector, IC_vector, options, equation_inputs)
@state_eqs_with_artifical_stability – in test case(TC)13, the equations called arexdot_TC13_1DOF_pitch_no _frict,
and obs_TC13_1DOF_pitch, however they are called through state_eqs_with_artifical_stability in ode15s as this
function includes a small lineof code in interpolate the inputvalues,creatinga subtle but important difference in the
input of each time period. Obviously,a handleto the original equations would work fine, but the format will be
different.
Once the simulation is run and the costfunction stored, compute_cost will output the current cost, the covariance
matrix and its augmentations, and the observation solutionscomputed by the ODE solver. The costfunction is
displayed,leavingthenext stage ready to optimisethe parameters.
Figure 4 –successful simulation ofa limit cycle overlaid on experimental data
3 Output Error Method
3.1 Introduction
Once the Maximum likelihood estimateof the parameter vectors has been established and subsequently the cost
function determined (4) the minimisation of this function can begin.A singular condition exists for this to occur
𝐽( 𝛩)
πœ•π›©
= 0
The partial differentiation of 𝐽( 𝛩) (4) returns
πœ•π½( 𝛩)
πœ•π›©
= βˆ’
1
𝑁
βˆ‘ [
πœ•π‘¦(𝑑 π‘˜)
𝑑𝛩
]
𝑇
π‘…βˆ’1
[𝑧( 𝑑 π‘˜
) βˆ’ 𝑦( 𝑑 π‘˜
)]𝑁
π‘˜=1
which is simpleto compute – the measured data z, the computed variables y and responsegradient
πœ•π‘¦(𝑑 π‘˜)
𝑑𝛩
all existin
the code, as does the computed valueof π‘…βˆ’1
. This expression however, cannotexplicitly computethe parameter
update which is required as the second gradient
πœ•2
𝐽( 𝛩)
πœ•π›©2
is notestablished.Attempting to do so in the same manner as
before is however time consumingand computationally expensive,therefore the change in the computed variables
must be approximated usingQuasi-linearization:
50 100 150 200 250 300 350 400 450 500 550
10
20
30
Pitchangle
(deg.)
090622_20ms_1dof_ramp_part2_OEM Results
50 100 150 200 250 300 350 400 450 500 550
-100
-50
0
50
Pitchrate
(deg./s)
50 100 150 200 250 300 350 400 450 500 550
-15
-10
-5
hawk
s
ervo1
50 100 150 200 250 300 350 400 450 500 550
20.3
20.4
20.5
Windtunnelvelocity
(m/s)
50 100 150 200 250 300 350 400 450 500 550
248
250
252
254
Dynamicpressure
(Pa)
50 100 150 200 250 300 350 400 450 500 550
-0.4
-0.2
0
0.2
0.4
Windtunnelaccel.
(m/$ms2$)
Time (seconds)
Exp Sim
(5)
(6)
𝑦( 𝛩) = 𝑦( 𝛩0 + βˆ†π›©) β‰ˆ 𝑦(𝛩0 ) +
πœ•π‘¦
𝛿𝛩
βˆ†π›©
Substitution of this into equation (4) leads to a system of separate,linear equations,which can be represented as
𝛩𝑖+1 = 𝛩𝑖 + βˆ†π›© π‘Žπ‘›π‘‘ πΉβˆ†π›© = βˆ’πΊ
𝐹 = βˆ‘ [
πœ•π‘¦(𝑑 π‘˜)
𝛿𝛩
]
𝑇
π‘…βˆ’1 [
πœ•π‘¦(𝑑 π‘˜ )
𝛿𝛩
]
𝑁
π‘˜=1
π‘Žπ‘›π‘‘ 𝐺 = βˆ’ βˆ‘ [
πœ•π‘¦(𝑑 π‘˜)
𝛿𝛩
]
𝑇
π‘…βˆ’1[ 𝑧( 𝑑 π‘˜
) βˆ’ 𝑦( 𝑑 π‘˜
)]
𝑁
π‘˜=1
F is the known as the information (or Hessian) Matrix,and is physically the matrix of second gradients. G is known as
the gradient vector, and with knowledge of both and usinglinear algebra, 𝛿𝛩 can besolved for. This gives 𝛩𝑖+1, which
is the solution to each iteration that we are lookingfor.
3.2.1 Coding Procedure:
run_optimiser – given the inputdecision in run.method, either the OEM or Filter Error Method (FEM) is chosen as the
estimation method, with the plot functions for the convergence criteria found atthe end of the function.
ml_oem_func – this function is the command station for the maximum-likelihood parameter estimation process that
accounts for the measurement noisefound in the experiment. The algorithmhas 2 stages
1. Explicitestimation of R
2. Gauss-Newton or Levenberg-Marquardt optimisation of the costfunction w.r.t parameters.
The optimisation method can be chosen using run.method_opt. and the firstfew segments of code are assigned for
selectingthe estimation options,all of which can also be changed usingthe run object.
The firstiteration loop begins with an estimation of the costfunction using costfun_oem – this has been calculated
already therefore a lengthy simulation isnotnecessary.The difference between the previous and current cost
function values is stored as an absolutevalue,and if the current cost is less than the previous,the optimiser has
verified its functionality and stores the parameters and standard deviations in the results matrix.A number of error
and state checks are implemented before the next stage begins.
Optimisation problem:
Determination of the parameter vector 𝛩 which minimises det( 𝑅)- the cost function.
First,the perturbations of each parameter (par_del) are calculated using run.paramater_step object as the scaling
constant. This matrix is then fed into grad_FG_new.
grad_FG_new - simulations of the experiment with added perturbations arecompleted using run_sim and stored in
cell array YP.This is run as an iteration of one parameter at a time, and then subsequently with the initial conditions
changed by their individual perturbations.
Debugging –this stage takes the most time in the parameter estimation process,as each perturbation simulation
takes as longas a singlerun of run_sim as used in the programme before. Any trail runs of the user’s specific codeto
debug problems should avoid this section of the code until necessary dueto the largetime expenditure (A2)
F and G should haveno null columns, and to test for this the user should be lookingatthe H matrix computed after
the simulationshavetaken place. The H matrix is the responsegradient
πœ•π‘¦( 𝑑 π‘˜)
𝛿𝛩
(9). q, the variablethatdefines the
numerator of H, is evaluated by taking the difference of the perturbed solution matrix YP at each time step, and the
previous iteration solution matrix Y. 𝛿𝛩 is simply the numerical changefor each parameter (par_del) and defines the
denominator of the response gradient. This definition is useful to know, as the H matrix should in theory have no null
columns due to the difference in solution never yieldingexactly zero. If a column does return a null solution, then
either
ο‚· The parameter step is not defined or is zero
ο‚· The parameters have not been defined correctly and the optimiser does not recognisethem.
(7)
(8)
(9)
50 100 150 200 250 300 350 400 450 500 550
10
20
30
Pitchangle
(deg.)
090622_20ms_1dof_ramp_part2_OEM Trim curve with data
Exp Trim
50 100 150 200 250 300 350 400 450 500 550
-100
-50
0
50
Pitchrate
(deg./s)
50 100 150 200 250 300 350 400 450 500 550
0
1
2
It is worth double checkingthese variablesand any other inputs that can influencethe definition of the parameters, as
this is the most common error to have duringthe PE process.
Now that the responsegradient has been established,the laststep of the function is to define F and G through simple
linear algebra,with the new values added onto the previous each iteration.
𝐻 =
πœ•π‘¦(𝑑 π‘˜ )
𝛿𝛩
improv – the optimisation segment of the code is selected using run.method_opt, choosingeither improv or
LM_method for the Gauss-Newton or Levenberg-Marquardt method respectively. Either method is acceptableand [1]
explains thesubtle differences very well.
Assuminga fully populated F matrix,its inversecan be calculated.The factthat F is symmetric and positive-definite
can be used to the situation’s advantage.Numerical inversionscan beinaccurateespecially when dealingwith large
batches of data,therefore the code makes use of a Cholesky factorisation to create the upper-triangular matrix (UTM)
needed to create an inversion [4].The chol function does this efficiently and is integral to the MATLAB script,requiring
no path definition.The essential matrix of parameter changes (𝛿𝛩) is described by delPar and is the explicitly the
inverseof F multiplied by G. Using the Cholesky method, this calculation isdoneby dividingtheUTM by its transpose,
then multiplyingthis by G.
3.2.2 Additional Calculations
As the linesearch segment is turned on (run.line_search = 1), the directional optimisation routineis allowed to take
place.minf_quad is responsiblefor the coremathematics involved in this process,and the user should refer to [5] for
further information. minf_quad yields an updated parameter vector which is used as the final output of the function.
Conditions for optimality for the variablesarestored using chk_lub_opt and any free parameters are dealtwith given
they exist.
The updated parameter vector is an output of improv and is fed back into ml_oem_func for reassembly in the main
parameter file.Both the original and latestmatrices arestored, the final parameter estimates, standard deviations
and correlation coefficients areprinted, then convergence plots aredrawn in run_optimiser using
plot_convergence_and_param_deviations, completing PE phase 7.
static_optimiser – run using PE_control phase 8, this segment of functions generates trim points from the
experimental data and the numerical run wherever the motion of the inputs and outputs aresupposed to be static.
For example, usingthe β€˜ramp_lin’ property in the run object, a static pointwould be generated for every step change
in the elevator ramp – every 10 seconds in the experiment. The new points are
ο‚· x_obs - the maximum and minimum of the observation variables for each static section
ο‚· t_new - the midpoints in time of each of the static sections
ο‚· Uinp_new – the mean of the inputs in each static section.
The new vectors are then used in perform_trim to revaluatethe F and G matrices,to output a new estimate of the
parameters and a new vector of the solution states x_new. This completes the optimisation iteration and the cycleis
repeated inside static_optimiser.
(9)
Figure 5 –trim points overlaid on experimental data
3.3 Post-processing
PE phase 9 can be run to save the parameter values that have resulted from a convergence, and sent to the global
parameter fileusingPEphase 10. Through to PE phase19, various plottingfunctions can becalled to display and
compare the data that has been processed.The user can chooseto change and adapt anythingin this section with no
consequence to the final parameters in the output of the estimation.
4 Filter Error Method
4.1 Introduction
The user should take accountfor the factthat the OEM used above directly accounts for turbulencein the experiment:
the input variables Uinp aremeasures of the wind components and arefed directly into the estimation routine with
littlerequirement to alter it. However, this approach relies on the measurement of said variables beingboth precise
and accurate, as both the wind angles and aerodynamic derivatives arecalculated usingthis data.In practice,the
process of setting up and recordingof Vt may not be easy or possible,therefore it would be useful to all parties to
have the capability of mathematically modellingturbulenceand estimatingparameters from this data. The
complication thatensues from this difference is however not trivial.
π‘₯Μ‡ = 𝐴π‘₯( 𝑑) + 𝐡𝑒( 𝑑) + 𝐹𝑀( 𝑑) + 𝑏 π‘₯, π‘₯( 𝑑0
) = 0
𝑦( 𝑑) = 𝐢π‘₯( 𝑑) + 𝐷𝑒( 𝑑) + 𝑏 𝑦
𝑧( 𝑑 π‘˜
) = 𝑦( 𝑑 π‘˜
) + πΊπœ—( 𝑑 π‘˜
), π‘˜ = 1,2 … , 𝑁
The non-measureable process noiseis included in the state equations as a noisedistribution matrix β€˜F’(9), and as a
resultthe system becomes stochastic – unpredictabledue to the influenceof a randomvariable [6].An estimator is
required to generate the values of the state at each time period, therefore states get β€˜propagated’, not integrated [2].
This is a key difference that underpins filter error methods.
𝐽( 𝛩, 𝑅) =
1
2
βˆ‘ [𝑧( 𝑑 π‘˜
) βˆ’ 𝑦̃(𝑑 π‘˜
𝑁
π‘˜=1 )] 𝑇
π‘…βˆ’1
[𝑧( 𝑑 π‘˜
) βˆ’ 𝑦̃( 𝑑 π‘˜
)]
𝑦̃, the output of the system incorporatingthepredicted states is the firstthing that must be calculated for the cost
function to be optimised. To do this,a classical linear quadraticestimator (LQR) is required: a Kalman filter [12]
provides everything that is required and is flexibleenough to be extended for non-linear equations,and works in a
two-step routine:
Prediction
π‘₯Μƒ( 𝑑 π‘˜+1
) = 𝑓𝑛( 𝛷, 𝛹)
𝑦̃( 𝑑 π‘˜
) = 𝑓𝑛( π‘₯Μƒ, 𝑒)
Correction
π‘₯Μ‚( 𝑑 π‘˜
) = π‘₯Μƒ( 𝑑 π‘˜
) + 𝐾[𝑧( 𝑑 π‘˜
) βˆ’ 𝑦̃( 𝑑 π‘˜
)]
K, the Kalman Gain Matrix,can be formulated from C, P and R, the observation matrix,the state prediction errors and
the covariancematrix of the squareerrors respectively. Whereas the calculation of R in the OEM was done usingan
integrator and matrix algebra,the stochastic natureof the equations means the prediction error must be taken into
accounthere as well,resultingin the equation
𝐾 = 𝑃𝐢 𝑇
π‘…βˆ’1
𝑅 = 𝐺𝐺 𝑇
+ 𝐢𝑃𝐢 𝑇
This simplestructure(15) (16) makes up the skeleton of the FEM, but the formulation of the prediction error matrix is
again not trivial and involves somecomplicated arithmetic. The importanceof this initial formulation should notbe
understated; however the application of the process to non-linear equations is far moreuseful, therefore the key
(9)
(10)
(11)
(12)
(13a)
(13b)
(14)
(15)
(16)
(17)
differences shall beexplained here in addition to the linear counterpart, as the code used in the programme is built
upon non-linear stateequations (17) (18).
π‘₯Μ‡( 𝑑) = 𝑓[ π‘₯( 𝑑), 𝑒( 𝑑), 𝛽] + 𝐹𝑀(𝑦) π‘₯( 𝑑0
) = π‘₯0
𝑦( 𝑑) = 𝑔[π‘₯( 𝑑), 𝑒( 𝑑), 𝛽]
The difficulty compared to linear systems is in the way the states and the costgradients are computed. The numerical
method of differentiation used in the OEM is applicableto the non-linear caseONLY when a firstorder approximation
is made of the state and measurement equations.Thankfully,the equations used in Pattinsons casearealready first
order and therefore the approximation is exact.If the system model is time invariantor quasi -timeinvariant,a steady
state as opposed to a time variant filter can be used for the state estimation:this is the process developed in the
programme. By usingthe system equations described abovein the general cost function (12), the non-linear extended
Kalman filter algorithmcan be administered,in the key steps described below:
1) Specify some startingvalues for the parameter vector (𝛩) consistingof parameters appearingin the system
functions f and g, initial conditionsx0 and elements of the process noisedistribution matrix F.
2) Specify suitablestartvalues for or generate an estimate of R.
3) Do the state estimation by applyingthe extended Kalman filter – computing gain matrix K, numerical
integration (propagation) of the state equations and computation of the predicted observation variables 𝑦̃.
4) Generate R classically.
5) Apply Gauss-Newton/Levenberg-Marquardt optimisation to update𝛩.
6) Repeat until converged.
4.2 Coding procedure
ml_fem_func – called fromrun_optimiser in placeof the OEM function, this function starts by making an initial
estimate of the R matrix usingthe method found in the OEM: integration of the state equations and the
determinant/inverse of the residuals(errors).This istheonly operation and output of costfun_fem. The next call is to
gainmat to calculatethe Kalman gain matrix for the current costvalues.
gainmat – although the non-linear stateequations arefunctions (f and g), the elements of the system (A and C)
remain in matrix form as in (9) however they must approximated due to the stochastic reasoningdescribed above.
The approximation is oneof central difference, hence sysmatA and sysmatC create A and C respectively by evaluating
the sum of the state equations at two discrete points a small perturbation in statevaluebetween each other, then
dividingby the absolutevalueof this difference. x0 is updated at each PE iteration to make this approximation
accurateeach time.
𝐴 =
(π‘₯Μƒ2(𝑑 π‘˜) βˆ’ π‘₯Μƒ1(𝑑 π‘˜))
𝑑π‘₯
The state prediction error covariancematrix element of K must next be calculated,and is done so by solvinga Ric cati
equation: (20)
𝐴𝑃 + 𝑃𝐴 𝑇
βˆ’
1
βˆ†π‘‘
𝑃𝐢 𝑇
π‘…βˆ’1
𝐢𝑃 + 𝐹𝐹 𝑇
= 0
The Riccati Equation – a firstorder ordinary differential equation thatis quadratic in theunknown function
π’šβ€²( 𝒙) = 𝒒 𝟎
( 𝒙) + 𝒒 𝟏
( 𝒙) π’š( 𝒙) + 𝒒 𝟐
( 𝒙) π’š 𝟐
(𝒙)
where q0 and q2 arenot equal to zero. If q0 were zero, the equation would be a Bernoulli equation,and q2 being zero
would reduce the equation to a firstorder ODE. [7]
The adaption of the solution to a classical ODEformulation is thatthere are many solution methods to choosefrom
that have been proven effective and where efficient coding already exists.gainmatmakes use of β€˜Potters Method’,
which does not requirederivation here, but itis enough to know that itis based on eigenvalue decomposition [1]. The
rest of the filefollows a standard Potters Method, and hence P is calculated,allowingthe output K to be compiled
from P, C and R usingsimplematrix algebra:
𝐾 = 𝑃𝐢 𝑇
π‘…βˆ’1
(18)
(19)
(20)
(15)
ml_fem_func (cont) – the precomputed valueof the F matrix is corrected usingthe new valueof R estimated in
gainmat usinga halvingsequenceto check for intermediate divergence and prevent it. Once the pre-calculation
checks have been completed to ensure divergence does not occur,the gradients matrices of the costfunction (F and
G) can be calculated. gainmat_pert calculates theK matrix for a small perturbation in the matrix of parameters to be
estimated (THETA) for use in the linearization approximation when using gradFG. This is exactly the same formulation
as in the OEM but with the difference that 𝑦̃ is used instead of y. After this calculation,itis possiblefor the parameters
to be updated usingthe quasi-linearization approach in (14),therefore a second gain matrix procedure needs to occur
to calculatethe costfunction without the initial estimates and savethe new parameters. The sequence of
ml_fem_func is described below for use in (14):
Kgain (initial estimate) Β¦ Kgain (perturbations) Β¦ Kgain (new parameters)
The current cost is carried through into run_optimiser where the code continues in the same way as before, which
concludes the FEM inclusion in theprocess once the iterations havecaused convergence.
5 BifurcationAnalysis
5.1 Introduction
The state equations that were used for the numerical simulation stagein this programme have many more
applications. Continuation and Bifurcation methods arepowerful tools in the analysis of many flightdynamics stability
problems, and make use of the state equations to derive the steady states of the model they present. A continuation
creates an approximatesolution to a set of differential equations given an arbitrary initial condition [8] very much like
a time integration, with the key difference that time is not the variablebeing changed. This β€˜continuation parameter’
can be any input into the system given ithas more than a null effect; as an example, the elevator anglein Pattinsons
experiment [2]. The parameter increased or decreased in sequence, and the output of the state equations recorded.
The field of study of Bifurcations isrich and varied,with many articles and books capableof describingthebas ic
concept and further details [8]. This partof the guide will help the user understand the set up process and run their
own continuation using MATCONT.
Integral to the programme is MATCONT 2.5.1, a continuation programme with a vastcapability for dealingwith
different types of state equation in the input. Due to the knowledge of the type of output expected, the run is split
into two parts:equilibriumcontinuation and a limitcyclecontinuation fromthe transition point. Note: this is not the
most updated version of MATCONT. Newer versions exist with a helpful GUI to help navigate the mainframe, which the
user can download if interested, but the two versions are not simply β€˜copy-and-paste’ acceptable.
The point of transition between an equilibrium(or otherwise) state and a limitcycleis known as a β€˜Hopf point’ (figure
6), which occurs due to a pair of complex conjugate eigenvalues crosses into the positiveplaneof the real axis.[8]
5.2 MATCONT
PE_control phase22 and 23 define the equilibriumand limitcyclesegments of the continuation respectively.
5.2.1 Equilibrium
plot_bf_diagram – this function is separatefrom any of the continuation subsections:itis responsiblefor plottingthe
experimental bifurcation diagramrecorded in the data matrix Bigmat. Entries can be changed to plotwhatever the
user wants,however in the current setting the function plots elevator angle againstpitch angle. The output of the
function is the figurehandle ifigure, a singlevaluefed into MATCONT to ensure the continuation is overlaid.
run_equillibrium_continuation – the user must firstdefine the continuer directories and put them on the current path.
Insidethe β€˜cd’ and β€˜path’ inputfield,the origin directory mustbe set to wherever the files were downloaded to (i.e.
β€˜C:DocumentsPE_download…’), allowingaccessto the MATCONT basecode. Results will besaved in a sub-directory
β€˜Results_new>Continuation_results’ which the programme will create,with filenames of run.result_file with the tag
β€˜results_bf_diag’ as set by the code in line10 of this function. MATCONT keeps its inputand output data in one .mat
filelabelled β€˜S’ (table)
S Description
x points on the curve
v tangent vectors along the curve
s found singularities
h continuation process variables
f phase response curve for limit cycles
Table 5 –description ofthe elements in S
If this filealready exists,then the continuer will simply usethis fileto run the continuation and update the attached
results file.If the filedoesn’t exist,the input conditions mustbe set up – this starts at line39.
Options: 1DOF_pitch_only Β¦ 2DOF_pitch_and_heave
1DOF – the pre-processingof the data begins by setting Uinp (dVt) to 0 then creatinga new matrix p of the saved
parameters and external inputs concatenated together. This matrix is a vector fileof singlevalues,not a matrix with
every step included.This is different to how the PE stages ran and the user must be aware of this difference. The
activeparameter β€˜ap’ is the continuation parameter and is defined as 11 – the 11th entry in β€˜p’, which is the elevator
angleinput. The choice of continuation parameter should be established here. Next, the state equations arespecified,
and nested function β€˜@manorig1D’ called to manipulatethem into a useableform.
@manoorig1D – this simplefunction sets the matrix state equations up for use in point by point analysis β€“β€˜dydt’ is the
unintegrated state variables vector.The second function attached in the filesimply evaluates the state equations over
a time period. This is an attempt to accountfor the difficulttime dependency that is incorporated into the state
equations (A3i)
init_EP_EP – the equations and parameters must be set in the format MATCONT requires.This function defines ea ch
parameter within the global variables thatMATCONT recognises,and outputs a single initial condition vector,and a
tangent vector for the startingpoint.
run_equillibrium_continuation (cont) – the next stage of this function is to establish theoptions that MATCONT refers
to when initializingits coreprocedures (Table5). The continuer stores the handleto the options in β€˜cds.options’.
Option Description Value
MaxNumPoints maximum number of points on the curve 100
MaxNewtonIters
maximum number of Newton-Raphson iterations before
switchingto Newton-Chords in the corrector iterations
200
MaxCorrIters maximum number of correction iterations 20
VarTolerance tolerance of coordinates 1e-8
FunTolerance tolerance of function values 1e-8
TestTolerance tolerance of test functions 1e-4
MoorePenrose
1/0 indicatingthe use of the Moore-Penrose continuation
as the Newtonlike corrector procedure
1
Increment
the increment to compute firstorder derivatives
numerically
1e-6
Backward 1/0 indicatingthe direction of the continuation 0
MaxStepSize the maximum stepsize 3e-2
MinStepSize the minimum stepsize to compute the next point 1e-12
InitStepSize the initial stepsize 1e-12
Eigenvalues 1/0 indicatingthe computation of the eigenvalues 1
Singularities 1/0 indicatingthe presence of a singularity matrix 1
Adapt number of points after which to call the adapt-function 1
Table 6 –description ofinput options for MATCONT from manual [13]
Singularities mustbe set to 1 as the continuation needs to recognise the Hopf point which will occur when the limit
cycle(LC) starts.MaxNumPoints has a direct correlation with the time taken to process the section, therefore take
carewhen choosingmore points.For the equilibrium continuation,fewer points are required as the local variation is
low.
cont is called next – this is the continuer stored in the MATCONT files and has no need to be changed. A call to this file
will run a continuation usingthe options,initial conditions and equations handle,and will output an S structure. The
results aresaved and the function ended. The final curveis plotted againstthe experimental continuation diagramfor
reference.
5.2.2 Limit Cycle
run_LC_cont_from_hopf – Sincethe equilibriumcontinuation hasalready been run, the S structure exists and the Hopf
point has been labelled and saved in S.s,meaning the preliminary 65 lines of code can be neglected, as they existfor
cases where the LC has been previously computed. The same continuation code is used to run the sequence; however
the options filewhich is defined in β€˜cds’ is different. The Hopf point labels mustalso bedefined so the continuer
knows where to start: β€˜ntst’, β€˜ncol’ and β€˜hopf_pt’ must all bedefined by the user and must match the labels given in
the output of the equilibriumcontinuation. For example, β€˜hopf_pt=2’ will causethe β€˜x’ solution atthe Hopf pointwith
label 2 to become the startingvector. Once this is done, the continuer must be told that the continuation is periodic
and must be adapted to accountfor this.
init_H_LC – as well as setting a MATCONT format, an initial cyclefromthe Hopf point detected on the equilibrium
curve must be calculated.The same tangent vector and initial conditions areoutputted, however the 3 labels defined
by the user must be stated in the input.
The continuer is then started again usingβ€˜cont’, the results plotted, and the results saved in >Continuation_results.
PE_control can be followed to make use of the different plotting functions,as well as run a 2 parameter bifurcation
usingthe lasttwo phases. This concludes the continuation phaseof the code, as well as the whole programme. The
user is nowleft with a parameter filewith the estimates made by either the OEM or the FEM, data for plottingthe
numerical simulation of the state equations,and bifurcation curvethat can be overlaid onto experimental data.
Havingrun this code successfully,theuser will nowhave knowledge of several tools thatcan be extremely useful in
the post processingof dynamical tests on aircraft.The limitto 1DOF in the examples provided by no means is the limit
of either the Parameter Estimation or Continuation code, and many examples existwithin the original codefrom
Jategaonkar [1] and in the MATCONT folder which the user is encouraged to try.
Figure 6 –continuation curve overlaid on experimental data
-18 -16 -14 -12 -10 -8 -6 -4 -2
5
10
15
20
25
30
35
40
Hawk elevator (deg.)
Pitchangle(deg.)
Appendix
A1 State Space Formulation – 1DOF
A simpleexample to help the user grasp the concept of writingequations of motion: example used mirrors the
equations of motion of the manoeuvre rigin [2].
1) Second order ODE that describes a general spring-massdamper
𝐼 𝑦𝑦 πœƒΜˆ + 𝐢 πœƒ πœƒΜ‡ + πΎπœƒ πœƒ = 𝑀
2) This equation is adapted to the manoeuvre rig – the assumptions includezero dampingand no friction,and
an inversion changingthe moment into its coefficientform.
πœƒΜˆ =
𝑀
𝐼 𝑦𝑦
πœƒΜˆ =
𝐢 𝑀
𝐼 𝑦𝑦
=
π‘žΜ… 𝑆𝑐̅ 𝑀
𝐼 𝑦𝑦
3) A second order variabletakes longer to integrate than a firstorder; therefore the state spaceform is required
to changethe problem to one of the firstorder. An arbitrary variable y is defined to equal the derivativeof
the state variable,then this variabledifferentiated to equal the double derivative.A third and final equation
𝑋̇ (see [2]) is added as itis a firstorder differential equation that can be integrated, and needs to be referred
to in the same way as the 1DOF variable.
𝑦 = πœƒΜ‡ 𝑦̇ = πœƒΜˆ =
𝐢 𝑀
𝐼 𝑦𝑦
Μ‡
𝑋̇ = 𝑓𝑛(𝑋, 𝛼)
4) A singlestatevector is formed of the three firstorder differential equations – this is much quicker to
integrate and formulate usingMATLAB.
π‘ π‘‘π‘Žπ‘‘π‘’ π‘’π‘žπ‘’π‘Žπ‘‘π‘–π‘œπ‘›π‘  = [
𝑦
𝑦̇
𝑋̇
] = π‘₯π‘‘π‘œπ‘‘
A2 Administering trails and tests
Trails and tests on the code are likely to be desired by the user for both debugging and adaption purposes; however it
is not immediately obvious how to do so. The structure of PE_control means a workspace is notsaved in-between
each of its stages – in factit is entirely internal and functions arewritten to keep it the programme this way. The user
must run functions individually and work around the processingproblems that occur.
The firstplaceto startin β€˜opening up’ the code is to create a usableworkspace:
1) Open the PE_control run file(β€˜run_TC13’), highlightthe stage 1 control, rightclick and selectβ€˜Evaluate
Section’, or press F9. This pre-processes the data to get it into a useableformat, and creates the run object to
be sent to the workspacefor use by other functions.
2) Open test_Define_case. This function will takethe output vector from Define_case and relabel each entry as
an individual variablewith the same name. Every function called after Define_case works off some derivation
of these variables thereforeanything can be run with a visible output.
Tests can be simply runningdifferent functions to see their numerical output: in this casewhen the function is partof
a loop, other inputvectors must be created to simulatethe state values atthat particular iteration. Individual testfiles
can also becreated that extract some key partof the code to run without havingto run the entire file.Some of these
are listed belowfor comparison:
ο‚· test_xdot_solver
ο‚· test_run_sim
ο‚· test_ode
ο‚· test_Define_case
(21)
(22)
(23)
(24)
A3 Equations and Inputs
Figure 8 –time series ofmeasured inputs in Uinp vector
A4 Definitions
Cost function - A costfunction 𝐢(π‘ž)is a function ofπ‘ž, which calculates theminimum cost for producing π‘ž units.
Handle – A function handleis a MATLAB valuethat provides a means of callinga function indirectly.
Measurement noise – the noisein takingmeasurements of the inputvalues in Uinp.
Procedure noise – the noiseinherent to the experiment (turbulence).
0 100 200 300 400 500 600
-20
-10
0
Time (s)
de
0 100 200 300 400 500 600
20.4
20.6
Time (s)
Vt
0 100 200 300 400 500 600
240
250
260
Time (s)
qbar
0 100 200 300 400 500 600
-0.5
0
0.5
Time (s)
dVt
Figure 7 –ODEsolver sequence for example
References
[1] Jategaonkar, R. V. (2006). Flight Vehicle System Identification (1st ed.). AmericanInstitute of Aeronautics and Astronautics.
[2] Pattinson, J., Lowenberg, M. H., & Goman, M. G. (2013). Investigationof Poststall Pitch Oscillations of an Aircraft Wind-Tunnel
Model. Journal of Aircraft, 50(6), 1843–1855. doi:10.2514/1.C032184
[3] Pattinson, J. (2010). Development andEvaluationof a WindTunnelManoeuvre Rig, (November).
[4] MATHWORKS. (2015). Choleskyfactorization. Available: http://uk.mathworks.com/help/matlab/ref/chol.html. Last accessed
18/8/2015.
[5] Elmer Forsythe, G., Malcolm, M. A., & Moler, C. B. (1977). Computer Methods of Mathematical Computations. (Prentice-Hall,
Ed.) (1st Editio., p. 200).
[6] Origlio, Vincenzo. "Stochastic." From MathWorld--AWolframWebResource, created byEric W. Weisstein.
http://mathworld.wolfram.com/Stochastic.html
[7] Weisstein, Eric W. "Riccati DifferentialEquation." From MathWorld--A WolframWebResource.
http://mathworld.wolfram.com/RiccatiDifferentialEquation.html
[8] Thompson, J. M. ., & Stewart, H. . (2002). Nonlinear Dynamics andChaos (Second., pp. 106–131).
[9] MATHWORKS. (2015). Object Orientated Programming inMATLAB. Available: http://uk.mathworks.com/discovery/object-
oriented-programming.html. Last accessed20/06/2015.
[10] Chia-Hui Chen, course materials for 14.01 Principles ofMicroeconomics, Fall 2007. MITOpenCourseWare (http://ocw.mit.edu),
Massachusetts Institute of Technology
[11] MATHWORKS. (2015). OrdinaryDifferential Equations. Available: http://uk.mathworks.com/help/matlab/math/ordinary-
differential-equations.html. Last accessed08/08/2015.
[12] Welch, G., & Bishop, G. (2006). An Introductionto the KalmanFilter. InPractice, 7, 1–16. doi:10.1.1.117.6808
[13] W. Govaerts, Y. a. K., & V. De Witte, A. Dhooge, H.G.E. Meijer, W. Mestrom, a. M. R. andB. S. (2011). MATCONT and CL
MATCONT: Continuation toolboxes inmatlab. …Gent, Belgium and…, 1–100. Retrieved from
http://uploads.tombertalan.com/12fall2012/502cbe502/hw/hw3/manual.pdf

More Related Content

What's hot

KnowledgeFromDataAtScaleProject
KnowledgeFromDataAtScaleProjectKnowledgeFromDataAtScaleProject
KnowledgeFromDataAtScaleProjectMarciano Moreno
Β 
[M4A2] Data Analysis and Interpretation Specialization
[M4A2] Data Analysis and Interpretation Specialization [M4A2] Data Analysis and Interpretation Specialization
[M4A2] Data Analysis and Interpretation Specialization Andrea Rubio
Β 
KNN and ARL Based Imputation to Estimate Missing Values
KNN and ARL Based Imputation to Estimate Missing ValuesKNN and ARL Based Imputation to Estimate Missing Values
KNN and ARL Based Imputation to Estimate Missing Valuesijeei-iaes
Β 
Learning machine learning with Yellowbrick
Learning machine learning with YellowbrickLearning machine learning with Yellowbrick
Learning machine learning with YellowbrickRebecca Bilbro
Β 
On Vector Functions With A Parameter
On Vector Functions With A ParameterOn Vector Functions With A Parameter
On Vector Functions With A ParameterQUESTJOURNAL
Β 
Verification of confliction and unreachability in rule based expert systems w...
Verification of confliction and unreachability in rule based expert systems w...Verification of confliction and unreachability in rule based expert systems w...
Verification of confliction and unreachability in rule based expert systems w...ijaia
Β 
House price prediction
House price predictionHouse price prediction
House price predictionSabahBegum
Β 
Pareto Type II Based Software Reliability Growth Model
Pareto Type II Based Software Reliability Growth ModelPareto Type II Based Software Reliability Growth Model
Pareto Type II Based Software Reliability Growth ModelWaqas Tariq
Β 
Application of Principal Components Analysis in Quality Control Problem
Application of Principal Components Analysisin Quality Control ProblemApplication of Principal Components Analysisin Quality Control Problem
Application of Principal Components Analysis in Quality Control ProblemMaxwellWiesler
Β 
Predicting Moscow Real Estate Prices with Azure Machine Learning
Predicting Moscow Real Estate Prices with Azure Machine LearningPredicting Moscow Real Estate Prices with Azure Machine Learning
Predicting Moscow Real Estate Prices with Azure Machine LearningLeo Salemann
Β 
Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...
Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...
Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...iosrjce
Β 
DETECTION OF RELIABLE SOFTWARE USING SPRT ON TIME DOMAIN DATA
DETECTION OF RELIABLE SOFTWARE USING SPRT ON TIME DOMAIN DATADETECTION OF RELIABLE SOFTWARE USING SPRT ON TIME DOMAIN DATA
DETECTION OF RELIABLE SOFTWARE USING SPRT ON TIME DOMAIN DATAIJCSEA Journal
Β 
Feature selection concepts and methods
Feature selection concepts and methodsFeature selection concepts and methods
Feature selection concepts and methodsReza Ramezani
Β 
MPSKM Algorithm to Cluster Uneven Dimensional Time Series Subspace Data
MPSKM Algorithm to Cluster Uneven Dimensional Time Series Subspace DataMPSKM Algorithm to Cluster Uneven Dimensional Time Series Subspace Data
MPSKM Algorithm to Cluster Uneven Dimensional Time Series Subspace DataIRJET Journal
Β 
Lab 2: Classification and Regression Prediction Models, training and testing ...
Lab 2: Classification and Regression Prediction Models, training and testing ...Lab 2: Classification and Regression Prediction Models, training and testing ...
Lab 2: Classification and Regression Prediction Models, training and testing ...Yao Yao
Β 
IRJET - Movie Genre Prediction from Plot Summaries by Comparing Various C...
IRJET -  	  Movie Genre Prediction from Plot Summaries by Comparing Various C...IRJET -  	  Movie Genre Prediction from Plot Summaries by Comparing Various C...
IRJET - Movie Genre Prediction from Plot Summaries by Comparing Various C...IRJET Journal
Β 
On the Choice of Models of Computation for Writing Executable Specificatoins ...
On the Choice of Models of Computation for Writing Executable Specificatoins ...On the Choice of Models of Computation for Writing Executable Specificatoins ...
On the Choice of Models of Computation for Writing Executable Specificatoins ...ijeukens
Β 
Observer pattern
Observer patternObserver pattern
Observer patternSamreen Farooq
Β 

What's hot (19)

KnowledgeFromDataAtScaleProject
KnowledgeFromDataAtScaleProjectKnowledgeFromDataAtScaleProject
KnowledgeFromDataAtScaleProject
Β 
[M4A2] Data Analysis and Interpretation Specialization
[M4A2] Data Analysis and Interpretation Specialization [M4A2] Data Analysis and Interpretation Specialization
[M4A2] Data Analysis and Interpretation Specialization
Β 
KNN and ARL Based Imputation to Estimate Missing Values
KNN and ARL Based Imputation to Estimate Missing ValuesKNN and ARL Based Imputation to Estimate Missing Values
KNN and ARL Based Imputation to Estimate Missing Values
Β 
Optimizer hint
Optimizer hintOptimizer hint
Optimizer hint
Β 
Learning machine learning with Yellowbrick
Learning machine learning with YellowbrickLearning machine learning with Yellowbrick
Learning machine learning with Yellowbrick
Β 
On Vector Functions With A Parameter
On Vector Functions With A ParameterOn Vector Functions With A Parameter
On Vector Functions With A Parameter
Β 
Verification of confliction and unreachability in rule based expert systems w...
Verification of confliction and unreachability in rule based expert systems w...Verification of confliction and unreachability in rule based expert systems w...
Verification of confliction and unreachability in rule based expert systems w...
Β 
House price prediction
House price predictionHouse price prediction
House price prediction
Β 
Pareto Type II Based Software Reliability Growth Model
Pareto Type II Based Software Reliability Growth ModelPareto Type II Based Software Reliability Growth Model
Pareto Type II Based Software Reliability Growth Model
Β 
Application of Principal Components Analysis in Quality Control Problem
Application of Principal Components Analysisin Quality Control ProblemApplication of Principal Components Analysisin Quality Control Problem
Application of Principal Components Analysis in Quality Control Problem
Β 
Predicting Moscow Real Estate Prices with Azure Machine Learning
Predicting Moscow Real Estate Prices with Azure Machine LearningPredicting Moscow Real Estate Prices with Azure Machine Learning
Predicting Moscow Real Estate Prices with Azure Machine Learning
Β 
Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...
Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...
Model Based Software Timing Analysis Using Sequence Diagram for Commercial Ap...
Β 
DETECTION OF RELIABLE SOFTWARE USING SPRT ON TIME DOMAIN DATA
DETECTION OF RELIABLE SOFTWARE USING SPRT ON TIME DOMAIN DATADETECTION OF RELIABLE SOFTWARE USING SPRT ON TIME DOMAIN DATA
DETECTION OF RELIABLE SOFTWARE USING SPRT ON TIME DOMAIN DATA
Β 
Feature selection concepts and methods
Feature selection concepts and methodsFeature selection concepts and methods
Feature selection concepts and methods
Β 
MPSKM Algorithm to Cluster Uneven Dimensional Time Series Subspace Data
MPSKM Algorithm to Cluster Uneven Dimensional Time Series Subspace DataMPSKM Algorithm to Cluster Uneven Dimensional Time Series Subspace Data
MPSKM Algorithm to Cluster Uneven Dimensional Time Series Subspace Data
Β 
Lab 2: Classification and Regression Prediction Models, training and testing ...
Lab 2: Classification and Regression Prediction Models, training and testing ...Lab 2: Classification and Regression Prediction Models, training and testing ...
Lab 2: Classification and Regression Prediction Models, training and testing ...
Β 
IRJET - Movie Genre Prediction from Plot Summaries by Comparing Various C...
IRJET -  	  Movie Genre Prediction from Plot Summaries by Comparing Various C...IRJET -  	  Movie Genre Prediction from Plot Summaries by Comparing Various C...
IRJET - Movie Genre Prediction from Plot Summaries by Comparing Various C...
Β 
On the Choice of Models of Computation for Writing Executable Specificatoins ...
On the Choice of Models of Computation for Writing Executable Specificatoins ...On the Choice of Models of Computation for Writing Executable Specificatoins ...
On the Choice of Models of Computation for Writing Executable Specificatoins ...
Β 
Observer pattern
Observer patternObserver pattern
Observer pattern
Β 

Similar to Parameter Estimation User Guide

AIRLINE FARE PRICE PREDICTION
AIRLINE FARE PRICE PREDICTIONAIRLINE FARE PRICE PREDICTION
AIRLINE FARE PRICE PREDICTIONIRJET Journal
Β 
Predicting Employee Attrition
Predicting Employee AttritionPredicting Employee Attrition
Predicting Employee AttritionShruti Mohan
Β 
Software engineering rogers pressman chapter 7
Software engineering rogers pressman chapter 7Software engineering rogers pressman chapter 7
Software engineering rogers pressman chapter 7mohammad hossein Jalili
Β 
Chapter 1 Data structure.pptx
Chapter 1 Data structure.pptxChapter 1 Data structure.pptx
Chapter 1 Data structure.pptxwondmhunegn
Β 
Machine Learning.pdf
Machine Learning.pdfMachine Learning.pdf
Machine Learning.pdfBeyaNasr1
Β 
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...Yao Yao
Β 
Robust and declarative machine learning pipelines for predictive buying at Ba...
Robust and declarative machine learning pipelines for predictive buying at Ba...Robust and declarative machine learning pipelines for predictive buying at Ba...
Robust and declarative machine learning pipelines for predictive buying at Ba...Gianmario Spacagna
Β 
Implementation of query optimization for reducing run time
Implementation of query optimization for reducing run timeImplementation of query optimization for reducing run time
Implementation of query optimization for reducing run timeAlexander Decker
Β 
VCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxVCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxskilljiolms
Β 
Performance Comparision of Machine Learning Algorithms
Performance Comparision of Machine Learning AlgorithmsPerformance Comparision of Machine Learning Algorithms
Performance Comparision of Machine Learning AlgorithmsDinusha Dilanka
Β 
Hartmann im00
Hartmann im00Hartmann im00
Hartmann im00Irfan Khan
Β 
Introduction to Data Structure and algorithm.pptx
Introduction to Data Structure and algorithm.pptxIntroduction to Data Structure and algorithm.pptx
Introduction to Data Structure and algorithm.pptxesuEthopi
Β 
Transaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptxTransaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptxRoshni814224
Β 
A02610104
A02610104A02610104
A02610104theijes
Β 
Model Driven Testing: requirements, models & test
Model Driven Testing: requirements, models & test Model Driven Testing: requirements, models & test
Model Driven Testing: requirements, models & test Gregory Solovey
Β 
AMAZON STOCK PRICE PREDICTION BY USING SMLT
AMAZON STOCK PRICE PREDICTION BY USING SMLTAMAZON STOCK PRICE PREDICTION BY USING SMLT
AMAZON STOCK PRICE PREDICTION BY USING SMLTIRJET Journal
Β 
user_defined_functions_forinterpolation
user_defined_functions_forinterpolationuser_defined_functions_forinterpolation
user_defined_functions_forinterpolationsushanth tiruvaipati
Β 
Rachit Mishra_stock prediction_report
Rachit Mishra_stock prediction_reportRachit Mishra_stock prediction_report
Rachit Mishra_stock prediction_reportRachit Mishra
Β 
Managing Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceManaging Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceKaren Morton
Β 

Similar to Parameter Estimation User Guide (20)

AIRLINE FARE PRICE PREDICTION
AIRLINE FARE PRICE PREDICTIONAIRLINE FARE PRICE PREDICTION
AIRLINE FARE PRICE PREDICTION
Β 
Predicting Employee Attrition
Predicting Employee AttritionPredicting Employee Attrition
Predicting Employee Attrition
Β 
Software engineering rogers pressman chapter 7
Software engineering rogers pressman chapter 7Software engineering rogers pressman chapter 7
Software engineering rogers pressman chapter 7
Β 
Chapter 1 Data structure.pptx
Chapter 1 Data structure.pptxChapter 1 Data structure.pptx
Chapter 1 Data structure.pptx
Β 
Machine Learning.pdf
Machine Learning.pdfMachine Learning.pdf
Machine Learning.pdf
Β 
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
Β 
Robust and declarative machine learning pipelines for predictive buying at Ba...
Robust and declarative machine learning pipelines for predictive buying at Ba...Robust and declarative machine learning pipelines for predictive buying at Ba...
Robust and declarative machine learning pipelines for predictive buying at Ba...
Β 
Implementation of query optimization for reducing run time
Implementation of query optimization for reducing run timeImplementation of query optimization for reducing run time
Implementation of query optimization for reducing run time
Β 
VCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxVCE Unit 01 (1).pptx
VCE Unit 01 (1).pptx
Β 
Performance Comparision of Machine Learning Algorithms
Performance Comparision of Machine Learning AlgorithmsPerformance Comparision of Machine Learning Algorithms
Performance Comparision of Machine Learning Algorithms
Β 
Hartmann im00
Hartmann im00Hartmann im00
Hartmann im00
Β 
Introduction to Data Structure and algorithm.pptx
Introduction to Data Structure and algorithm.pptxIntroduction to Data Structure and algorithm.pptx
Introduction to Data Structure and algorithm.pptx
Β 
Transaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptxTransaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptx
Β 
A02610104
A02610104A02610104
A02610104
Β 
Model Driven Testing: requirements, models & test
Model Driven Testing: requirements, models & test Model Driven Testing: requirements, models & test
Model Driven Testing: requirements, models & test
Β 
AMAZON STOCK PRICE PREDICTION BY USING SMLT
AMAZON STOCK PRICE PREDICTION BY USING SMLTAMAZON STOCK PRICE PREDICTION BY USING SMLT
AMAZON STOCK PRICE PREDICTION BY USING SMLT
Β 
user_defined_functions_forinterpolation
user_defined_functions_forinterpolationuser_defined_functions_forinterpolation
user_defined_functions_forinterpolation
Β 
Rachit Mishra_stock prediction_report
Rachit Mishra_stock prediction_reportRachit Mishra_stock prediction_report
Rachit Mishra_stock prediction_report
Β 
Managing Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceManaging Statistics for Optimal Query Performance
Managing Statistics for Optimal Query Performance
Β 
ML-Unit-4.pdf
ML-Unit-4.pdfML-Unit-4.pdf
ML-Unit-4.pdf
Β 

Parameter Estimation User Guide

  • 1. Contents Contents................................................................................................................................................ 1 1 Parameter Estimation Basics............................................................................................................ 2 1.1 Concept Summary................................................................................................................... 2 2 – Getting Started ................................................................................................................................. 2 2.1 the Run object......................................................................................................................... 2 2.1.1 Run object definition ........................................................................................................ 2 2.2 Equations and Constants................................................................................................................ 7 2.2.1 Observation Equations...................................................................................................... 7 2.2.2 State Equations ................................................................................................................ 7 2.3 Defining parameters ................................................................................................................ 8 2.4 Tools Directory ........................................................................................................................ 8 2.5 Starting the run ....................................................................................................................... 8 2.5.1 Pre-processing.................................................................................................................. 8 2.5.2 Simulation........................................................................................................................ 9 3 Output Error Method......................................................................................................................10 3.1 Introduction...........................................................................................................................10 3.2.1 Coding Procedure:...........................................................................................................11 3.2.2 Additional Calculations ....................................................................................................12 3.3 Post-processing......................................................................................................................13 4 Filter Error Method ........................................................................................................................13 4.1 Introduction...........................................................................................................................13 4.2 Coding procedure ...................................................................................................................14 5 BifurcationAnalysis........................................................................................................................15 5.1 Introduction...........................................................................................................................15 5.2 MATCONT..............................................................................................................................15 5.2.1 Equilibrium......................................................................................................................15 5.2.2 Limit Cycle.......................................................................................................................17 Appendix...............................................................................................................................................18 A1 State Space Formulation – 1DOF..............................................................................................18 A2 Administering trails and tests ..................................................................................................18 A4 Definitions..............................................................................................................................19 References............................................................................................................................................20
  • 2. Introduction This document will guidethe user through a complete run of a Numerical Simulation,Output Error Parameter Estimation,and a Continuation procedure of an aircraftconstrained in 1 Degree of Freedom (1DOF), usingan experiment undertaken in the University of Bristol as an example.This packagecan be modified with ease to use other estimation methods (Equation Error and Filter Error),and can be applied widely given experimental data and a numerical model of the experiment exists.J.Pattinson holds creditfor adaptingthis code from the supplements in [1], for use in his thesis [3].As partof a project undertaken in 2015, the author used this code for further analysisof the same problem, but found many difficultiesin runningitin the same way. This document was written to help the user understand how the theoretical practices of Parameter Estimation discussed in many documents are implemented usingMATLAB, and how the individual parts interactwith each other to come to the correct output. The aimis provideaccess to toolbox to aideany work wantingto utilizethese methods without prior experience of codingthem. 1 Parameter EstimationBasics 1.1 Concept Summary The concept of Parameter Estimation is relatively easy to grasp.The analogy to linear regression is thefirstplace someone strugglingto understand itshould turn – when two curves of discretedata points existin the same domain, the β€˜lineof best fit’ between them falls where the sum of their differences is minimized.This is commonly known as β€˜leastsquares’regression and is a well-known foundation of optimisation.Equation Error parameter estimation is exactly likethis.One of the discretecurves is experimental data measured under controlled conditions,and the other is a simulation of the same experiment numerically.The numerical curveis created by integratinga set of differential equations (A1) and evaluatingthem at each time point of the experiment; the conditions in theequations will affect the response to the independent variablebeingchanged in the test. The aimof Parameter Estimation is to find the lineof best fit, and this is achieved by manipulating these conditions,or parameters (1), until the error between the simulated and experimental curves is minimised.The parameters found for the minimized condition will describethe real-world model, dependant on the accuracy of the differential equations.A detailed description of the equations and parameters used in this example can be found in [2] 𝛩 = [𝐢 𝐿 𝛼 𝑀 , 𝐢 𝐿 π›Όβ„Ž , 𝛼0 𝑀 , πœ€ 𝐢 𝐿 , 𝐢 𝑀 π‘ž 𝑀 , π‘Ž1, 𝜏1, 𝜏2, π›Όβˆ— , 𝐢 𝐿 π‘œπ‘“π‘“π‘ π‘’π‘‘ ] 2 Getting Started 2.1 the Run object Object Orientated Programming (OOP) is a styleof computer programmingwhereby the programmer uses the concept of objects,structures containingdata fields and procedures,to simplify the management of complex software. In MATLAB, objects come in classes with properties (data fields) and methods (procedures) to control multiplefunctions and scripts fromone control. The applicationsof OOP are richly spread and numerous,but for this specific code,the use of an object can be seen as the centre of a branch diagram,providingthe necessary data for all functions involved in the programme. This approach increasesthe flexibility of the code to encompass different experimental scenarios with ease,which makes for a much more user friendly experience. [9] The run object only uses its properties field to feed into the many functions that encompass the programme. Rather than changingthese fields individually in each script,the run object will providethat information globally,extending the use beyond the specified function.The object properties can be edited locally and kept for use in temporary storage, but caremust be taken to clear the object edited fields before each run to revert the object back to its original conditions.The β€˜clear all’function can do this. 2.1.1 Run object definition The next 4 pages explain the purpose and format of each entry in the run object file. Before startingany run, every property should be doublechecked againstthe description. (1)
  • 3. Property Value Description Flag File Reference state_equations 'xdot_TC13_1DOF_pitch_no_frict' The .m fileresponsiblefor the state equations β€˜X’ in equation 2 being called every time a simulation is required to run or a state evaluated. #1,2 - observation_equations β€˜obs_TC13_1DOF_pitch’ The .m fileresponsiblefor processingthesimulated data for the observation variableβ€˜Y’ in equation 2. This is processed immediately after the state equations to providethe output comparison to the experimental data #1,2 - num_of_states 4 The .m fileresponsiblefor processingthesimulated data for the observation variableβ€˜Y’ in equation 2. This is processed immediately after the state equations to providethe output comparison to the experimental data - - num_of_observables 2 This valueshould be consistentwith the number of entries in the 1xn state equation fileoutput. This must match for the parameter fileto be generated correctly. - - num_of_inputs β€˜4’ This valueshould match the number of inputs in the matrix used to utilisethe OEM’s capability to model noise. In this case,each inputcorrelates to a measured experimental quantity. #2 - num_of_parameters β€˜11’ This number should match the number of parameters that the optimiser will recogniseand process in the Output Error Method. Be careful in recognisingwhich variables thecode views as parameters. #2 - run_type β€˜1DOF_pitch_only’ This code will tolerateexperiments in 1DOF pitch or 2DOF pitch and heave. More types can be added but for the purposes of this code, the two options are β€˜1DOF_pitch_only’ and β€˜2DOF_pitch_and_heave’. #2 - rig_config β€˜1’ Retain valueof 1 for calculation of the riginfluenceon the model. #2 preprocess_data preprocessing_flags β€˜1’ Enables the inclusion of servo data in the main data matrix #2 preprocess_data filter_span β€˜3’ The window half width used for differentiatingthe values of tunnel velocity usingan inverseTaylor Series approach. Nominally setas 3 but play around to get the best results. #2 preprocess_data
  • 4. Property Value Description Flag File Reference filter_order β€˜2’ The order of the derivativeapproximation made – this can be bigger than what you want out, so set as 2 for a firstorder differential likedVt. #2 preprocess_data method β€˜OEM’ Decision of which approach to take for the Parameter Estimation partof the code. A choiceof EEM, OEM, or FEM. #2 Define_case method_opt β€˜OEM_GN’ Controls which optimisation method will be undertaken: Gauss-Newton or Levenberg-Marquardt. A choiceof OEM_GN, OEM_LM, EEM_LM, OEM_GN, EEM_GN #2 Define_case line_search 1 Used to inducethe linesearch function in the Gauss Newton optimisation procedureto optimisein a certain direction. - Define_case run_start_time {340} The startingtime of the numerical simulation.Used in graphingfor experimental comparison and normalised during the simulation. #3 Define_case run_end_time {400} The ending time of the numerical simulation.Same uses as above. #3 Define_case data_from_file {'090622_20ms_1dof_ramp_part 2_processed'} This property calls theresults filethatmay or may not exist depending on previous runs of the samefile. The user can define any name for this filebut for convenience the same name as the core experimental data filehas been used. #1,2,3 Define_case nzi β€˜1’ The number of time segments (or data files) used in the processing.The requirement to use sequential data files is not uncommon, but will takea longer time, so limitingto two large files would be sensible. #2 Define_case exp_obs_data_index {'theta_a', 'dtheta_a'} This singularmatrix defines which variables in thechosen β€˜BigMat’ data filethat the estimation tool will takeas the observation variables. #2,3 Define_case exp_inp_data_index {'hawk_servo1','Vt','qbar','dVt'} This singularmatrix defines which variables in thechosen β€˜BigMat’ data filethat the estimation tool will takeas the input variables.These will bemeasured experimental values. #2,3 Define_case
  • 5. Property Value Description Flag File Reference compute_x0 1 This programme has the capability of definingthe initial conditions for each of the states simply by referencing the BigMat data fileat the initial timepoint specified in Define_case. If the user does not want these values or they are not producinga good output, select β€˜0’ and create the x0 matrix yourself,ensure the dimensions and orientation arethe same. - Define_case directly_obs_states [1,1] This matrix triggers the use of the observation variable generated in the simulation for usein further processing.The matrix must be the same dimension as the observation variableβ€˜Y’. The entries match up with the entries in this variable.Avalueof 0 will mask the chosen entry. For most purposes,this should always bepopulated with ones. #4 Define_case params_from_csv_or_ mat β€˜csv’ The parametervaluesatthe starting,latestandsaved pointswill be recordedintoafile,whichMATLABwill processintoa csv (commaseparatedvalues) ora mat (MATLAB matrix) file.The choice of whichwill be specifiedhere.Choosingcsvmakesediting andviewing simpler,butcallingsimplicitywouldfavouramat file. #2 load_and_check_parameters results_file β€˜090622_20ms_1dof_ramp_part2 _processed’ This stringdefines the name of the results filethe final parameters postestimation are output to. Can be any name but for ease of trackingthe same name as the input fileis used throughout. #2 load_and_check_parameters which_parameters β€˜start’ This stringwill decidewhether the starting,latestor saved parameters saved in the parameter csv/matfile are used in the latestrun of the state equations.Start, latestor saved. #2 load_and_check_parameters obs_plot_mask [1,1] A valueof 0 in these entries masks the plotting of the observation variablein question.Matrix must be consistent with the sizeof the observation variablematrix. #4 plot_output inp_plot_mask [1,1,1,1] A valueof 0 in these entries masks the plotting of the input variablein question.Matrix mustbe consistentwith the sizeof the input variablematrix β€˜Uinp’. #4 plot_output Property Value Description Flag File Reference
  • 6. static_type β€˜ramp_lin’ This property should be defined accordingto the type of linear progression the input takes. This is for setting up the function that trims the inputto help the user match the output after one iteration.A constantinitial condition (X0),a singlepoint (single) or a linear ramp (ramp_lin) arethe options. #2 generate_trim_points ramp input [1] Verify input of a ramp type #4 generate_trim_points trim_switch 4 Decision outof 1, 2, 3 or 4 of which trim path to take. This property is related to input type and is described in the function. - generate_trim_points velocity_states 0 The number of velocity states in the trim input – set to zero - generate_trim_points generate_static_file 1 1 to generate a new fileof static points,0 to ignore. - generate_trim_points static_file 'TC_13_static_results' Name of static fileif decided to create one #2 generate_trim_points input_delay_mask β€˜nomask’ This property defines whether or not a delay is required in the input file.If this property is a number (1), the function will generate a delay and rewrite the Uinp variable.If itis a string (mask), the delay creation will bemasked. #2 compute_cost parameter_step_function 1e-3 This property will control the sizeof step taken when varying the parameters in each iteration. - oem_func convergence_tolerance 1e-3 This property will definethe limitof accuracy the optimiser will takebetween trails until a solution isreached that has a difference of less than this value - oem_func num_iterations 1 This property defines the number of Parameter Estimation iterations taken. Each iteration will takethe new parameters estimated from the previous iteration and use them as the new X0. For a full run of the current experiment (600 seconds), more than one iteration will takea very long time (1hr+). - oem_func Flags #1 - full filename without the .m #2 - stringtype therefore insidequotation marks for compatibility #3 - singularmatrix definition required therefore includecurly brackets for compatibility #4 - singularmatrix numeric definition required therefore includesquarebrackets for compatibility
  • 7. 2.2 Equations and Constants The equations required for numerical simulation should beheld in two files – the state equations and the observation equations,and should be kept in the >Models directory. Wihin these files however, as many functions and constants can be called as desired,in accordancewith how the user wants the simulation to run. 2.2.1 Observation Equations As an example, obs_TC13_1DOF_pitch outputs the observation variableYgiven an input from the state integration of (2). This output is used in the cost function to directly compareagainstthe experimental data, and is simply an augmentation of rigpitch and pitch rate. Table 1 shows the MATLAB requirements for the function. Inputs time Β¦ state Β¦ inputs Β¦ parameters Outputs Y (observation vector) Table 1 –list ofinput and outputs ofthe observation equations function 2.2.2 State Equations xdot_TC13_1DOF_pitch_no_frict outputs a state vector of values thatare integrated to form the numerical simulation, and are slightly lessflexiblein terms of format. For the integration to work, the inputs must includetime previous state values inputvariables for each time step and a vector of parameters .This vector of parameter s is importantto define correctly. An efficiency of this programme is its useof a singleequations filefor each operation- integration, estimation and continuation.The estimation segment requires categorisation of the parameters in order to optimise them, whereas the other operations do not, so the parameters aredefined as variables in stages 6 and 7, and constants for the remainingoperations.Table 2 shows the MATLAB requirements for the function. Note: the equations must be written in state space form (A1). π‘Œ = 𝑋(πœƒ) Inputs time Β¦ state Β¦ inputs Β¦ parameters Outputs xdot (state vector) Table 2-list ofinputandoutputs ofthe state equations function The firstlines of the state equations file(figure 1) should define the function inputs as variablesin the equation: ο‚· States should correspond to the β€˜x’ input: a [n,d] matrix,where n=run.num_of_states and d=length(data file) – the number of discrete data points. ο‚· Equation inputs can come from any number of variables in thefunction definition;however itis easier to manage a singlevector usually labelled β€˜u’. ο‚· The constants of calculation (Centre of Gravity position,rigmoments of inertia etc.) are externally derived – they are kept in a singlefilefor global applicability.For the purposes of Pattinsons experiments, the constants come from the wind tunnel rigand test model – a Bae Hawk, therefore the >Hawk and >Rig directories hold the information files related to each element of the experiment. hawk_constants is a function that when (2) Figure 1-first lines ofstate equations used for input definition
  • 8. called in any function will outputonly the constants required for the specified analysis type,ensuringthe size of the constants matrix will alwaysbe compliantwith what is required of it. All constants should bechanged in this file. 2.3 Defining parameters The parameter definition is littlemoreinvolved and easy to do wrong, however the steps are simple. 1. Locate the equation filethat includes the useof any estimation parameters. This may be the straightstate equation file,or itmay be a nested function insideof here – in test case 13, the nested function Hawk_2DOF_M05 is responsiblefor the core physical calculations(the xdot files simply preparethe states for processingin this file). 2. Create a _spec filewith the same filename (i.e. Hawk_2DOF_M05_spec.m), followingthe same format as the current _spec files. 3. Create enclosed strings with entries exactly the same as the variablenames described in hawk_estimates. The _spec filewill usethis stringto call the β€˜estimates’ matrix created in hawk_estimates, and then create a new matrix based on the findingof matching strings,populated with the numeric values associated with those entries. This matrix becomes part of the results filewhich stores the initial values in theestimates file, then updates once new values arefound from the estimation process. 4. Save files,then define each correspondingvariablein the nested function file as param(n),where n=run.num_of_parameters. The vector β€˜param’ will automatically become the dimensions of n and be populated with the initial estimates. 2.4 Tools Directory The >Tools directory holds the majority of the functions spread out over the programme. This should be the first reference when tryingto locatea function. The only other options are the >Matlab_tools and the >Output_error_method directories for general arithmetic OEM specific functions. 2.5 Starting the run Once the properties in the runA object are defined, the programme needs to be started. The programme is builtup in stages, to enable individual sectionsto be run and reduce run times. The PE_control file(table 3) holds all the function callsfor each stage, and includes an inputhandlethat callseach stage.To run a stage, a separatefilemust be created that runs the PE_control function.This has been called β€˜run_TC13’ in the examples.Highlightingeach command (i), rightclicking,and selecting Evaluate Section will run a singlestageonly. π‘Ÿπ‘’π‘› = 𝑃𝐸_π‘π‘œπ‘›π‘‘π‘Ÿπ‘œπ‘™ (π‘Ÿπ‘’π‘›π΄, π‘₯, π‘₯, 𝑛) Stage Description 1-3 Pre-processing 4/5 Plottingand costfunction calculation 6/7 Parameter Estimation steps 8-22 Plottingand post-processing 22-26 Continuation and plotting Table 3- summary ofthe operations included in PE_control 2.5.1 Pre-processing add_remove_paths - MATLAB requires information of where each individual fileis stored to be ableto access it:this allows theuser to logically createfolders and avoid singlefolders with huge numbers of files.The function add_remove_paths will do this automatically given a description of each folder location.This will need to be changed for each new use of the programme. An inputof β€˜1’ will add the files,whereas an input of β€˜-1’ will remove them from the path. You can check the paths MATLAB is awareof by selecting Home>Set Path. (i) Figure 2-toolbar choices for accessing the MATLAB path
  • 9. Pre_process -The raw data in the experimental files needs to be processed into a singlematrix of values for global use. Upon loading,the BigMat matrix holds all of this data,with the BigMat_names (table4) cell separately definingeach column. Raw data is kept in the >Experimental_data directory. Any additional files of this type should be stored here. 1 2 3 4 5 6 7 8 9 10 time rig_roll rig_pitch rig_yaw model_ pitch model_ yaw encoder0 encoder1 encoder 2 encoder3 11 12 13 14 15 16 17 18 19 20 comp_ servo0 comp_ servo1 comp_ servo2 comp_ servo3 hawk_ servo0 hawk_ servo1 hawk_ servo2 hawk_ servo3 hawk_ servo4 Vt 21 22 23 24 25 26 27 28 29 30 qbar hawk_ servomdl0 hawk servomdl1 hawk_ servomdl2 hawk_ servomdl3 hawk_ servomdl4 Vt_smooth dVt encoder0_ smooth encoder1_ smooth 31 32 33 34 35 36 37 38 39 40 encoder2_ smooth encoder3_ smooth theta_a dtheta_a ddtheta_a hawk_de hawk_den alpha_a dalpha_a M_a Table 4 –BigMatnames matrix corresponding to the example only The pre-processor includes calculation of wind angles and riginfluence,producingthe last8 columns in the matrix. generate_parameter_file - The parameter fileto hold the initial,latestand saved parameters must be generated for use in the estimation segment. The output is a .csv or .mat filethat can be viewed in the >Results_new directory.An extra set of rows is added to the parameter vector β€˜param’ which are populated by the initial conditionsβ€˜X0’,a vector of length [n,1] where n=run.num_of_states. Define_case - This fileis critical to the overall operation of the programme: every variablethe test casecould need is set up in this fileand saved to a local workspaceinsidethe routine. This workspaceis notvisibleif runningthe programme directly from PE_control, therefore this function must be run alonebefore any trailsor tests can be administered (A2). The function is splitinto segments to alloweasier trackingof the variables beinggenerated. β€˜X0’, the initial conditions (IC’s) of the states can be evaluated and stored here if run.compute_x0 returns 1. If the computed IC’s areunsatisfactory,an independent matrix can be written here. 2.5.2 Simulation The firstphaseof the processingpartof the code is to compute the value of the primary costfunction,done so from the compute_cost_and_plot function. The function call path is as below: compute_cost – firstchecks whether a simulation already exists,then concatenates the system parameters and initial conditions into one vector, providingan inputto costfun_oem. The simulation check is doneso that a lengthy repeat of the simulation is notrequired when the optimiser attempts to run one again. costfun_oem – runs a time integration using run_sim as the function controllingtheintegrator. Once this is complete, the covariancematrix R(3) (the maximum likelihood estimateof the output errors) is calculated, and then the determinant of its diagonal evaluated to give the value of the current costfunction (4). 𝑅 = 1 𝑁 βˆ‘ [ 𝑧( 𝑑 π‘˜ ) βˆ’ 𝑦( 𝑑 π‘˜ )][𝑧( 𝑑 π‘˜ ) βˆ’ 𝑦( 𝑑 π‘˜ )] 𝑇𝑁 π‘˜=1 𝐽( 𝛩, 𝑅) = 1 2 βˆ‘ [𝑧( 𝑑 π‘˜ ) βˆ’ 𝑦(𝑑 π‘˜ 𝑁 π‘˜=1 )] 𝑇 π‘…βˆ’1 [𝑧( 𝑑 π‘˜ ) βˆ’ 𝑦( 𝑑 π‘˜ )] run_sim – this function controls the integration step, processes the results through the observation equations and outputs this as a singlevariable Y(figure 4). The options associated with the ODE solver aredeclared here, as well as the global variablesinsidethe state equations for storingthe evaluated values of state (A3). (3) (4) Figure 3 –function structure within compute cost and plot
  • 10. ode15s – is a standard MATLAB ODE solver for stiff differential equations.The output xs is a matrix of state solutions with length equal to the number of discrete data points.The β€˜options’ values should beclosely checked to ensure the time induces the samenumber of points. This solver is variablestep,which dramatically affects the outcome when a time delayed inputis involved (A3). ODE solver format – the common format exercised in all MATLAB solvers is as follows [11]: options = odeset (β€˜option_choices’) [time_points, state_solution] = solver (@equationhandle, time_vector, IC_vector, options, equation_inputs) @state_eqs_with_artifical_stability – in test case(TC)13, the equations called arexdot_TC13_1DOF_pitch_no _frict, and obs_TC13_1DOF_pitch, however they are called through state_eqs_with_artifical_stability in ode15s as this function includes a small lineof code in interpolate the inputvalues,creatinga subtle but important difference in the input of each time period. Obviously,a handleto the original equations would work fine, but the format will be different. Once the simulation is run and the costfunction stored, compute_cost will output the current cost, the covariance matrix and its augmentations, and the observation solutionscomputed by the ODE solver. The costfunction is displayed,leavingthenext stage ready to optimisethe parameters. Figure 4 –successful simulation ofa limit cycle overlaid on experimental data 3 Output Error Method 3.1 Introduction Once the Maximum likelihood estimateof the parameter vectors has been established and subsequently the cost function determined (4) the minimisation of this function can begin.A singular condition exists for this to occur 𝐽( 𝛩) πœ•π›© = 0 The partial differentiation of 𝐽( 𝛩) (4) returns πœ•π½( 𝛩) πœ•π›© = βˆ’ 1 𝑁 βˆ‘ [ πœ•π‘¦(𝑑 π‘˜) 𝑑𝛩 ] 𝑇 π‘…βˆ’1 [𝑧( 𝑑 π‘˜ ) βˆ’ 𝑦( 𝑑 π‘˜ )]𝑁 π‘˜=1 which is simpleto compute – the measured data z, the computed variables y and responsegradient πœ•π‘¦(𝑑 π‘˜) 𝑑𝛩 all existin the code, as does the computed valueof π‘…βˆ’1 . This expression however, cannotexplicitly computethe parameter update which is required as the second gradient πœ•2 𝐽( 𝛩) πœ•π›©2 is notestablished.Attempting to do so in the same manner as before is however time consumingand computationally expensive,therefore the change in the computed variables must be approximated usingQuasi-linearization: 50 100 150 200 250 300 350 400 450 500 550 10 20 30 Pitchangle (deg.) 090622_20ms_1dof_ramp_part2_OEM Results 50 100 150 200 250 300 350 400 450 500 550 -100 -50 0 50 Pitchrate (deg./s) 50 100 150 200 250 300 350 400 450 500 550 -15 -10 -5 hawk s ervo1 50 100 150 200 250 300 350 400 450 500 550 20.3 20.4 20.5 Windtunnelvelocity (m/s) 50 100 150 200 250 300 350 400 450 500 550 248 250 252 254 Dynamicpressure (Pa) 50 100 150 200 250 300 350 400 450 500 550 -0.4 -0.2 0 0.2 0.4 Windtunnelaccel. (m/$ms2$) Time (seconds) Exp Sim (5) (6)
  • 11. 𝑦( 𝛩) = 𝑦( 𝛩0 + βˆ†π›©) β‰ˆ 𝑦(𝛩0 ) + πœ•π‘¦ 𝛿𝛩 βˆ†π›© Substitution of this into equation (4) leads to a system of separate,linear equations,which can be represented as 𝛩𝑖+1 = 𝛩𝑖 + βˆ†π›© π‘Žπ‘›π‘‘ πΉβˆ†π›© = βˆ’πΊ 𝐹 = βˆ‘ [ πœ•π‘¦(𝑑 π‘˜) 𝛿𝛩 ] 𝑇 π‘…βˆ’1 [ πœ•π‘¦(𝑑 π‘˜ ) 𝛿𝛩 ] 𝑁 π‘˜=1 π‘Žπ‘›π‘‘ 𝐺 = βˆ’ βˆ‘ [ πœ•π‘¦(𝑑 π‘˜) 𝛿𝛩 ] 𝑇 π‘…βˆ’1[ 𝑧( 𝑑 π‘˜ ) βˆ’ 𝑦( 𝑑 π‘˜ )] 𝑁 π‘˜=1 F is the known as the information (or Hessian) Matrix,and is physically the matrix of second gradients. G is known as the gradient vector, and with knowledge of both and usinglinear algebra, 𝛿𝛩 can besolved for. This gives 𝛩𝑖+1, which is the solution to each iteration that we are lookingfor. 3.2.1 Coding Procedure: run_optimiser – given the inputdecision in run.method, either the OEM or Filter Error Method (FEM) is chosen as the estimation method, with the plot functions for the convergence criteria found atthe end of the function. ml_oem_func – this function is the command station for the maximum-likelihood parameter estimation process that accounts for the measurement noisefound in the experiment. The algorithmhas 2 stages 1. Explicitestimation of R 2. Gauss-Newton or Levenberg-Marquardt optimisation of the costfunction w.r.t parameters. The optimisation method can be chosen using run.method_opt. and the firstfew segments of code are assigned for selectingthe estimation options,all of which can also be changed usingthe run object. The firstiteration loop begins with an estimation of the costfunction using costfun_oem – this has been calculated already therefore a lengthy simulation isnotnecessary.The difference between the previous and current cost function values is stored as an absolutevalue,and if the current cost is less than the previous,the optimiser has verified its functionality and stores the parameters and standard deviations in the results matrix.A number of error and state checks are implemented before the next stage begins. Optimisation problem: Determination of the parameter vector 𝛩 which minimises det( 𝑅)- the cost function. First,the perturbations of each parameter (par_del) are calculated using run.paramater_step object as the scaling constant. This matrix is then fed into grad_FG_new. grad_FG_new - simulations of the experiment with added perturbations arecompleted using run_sim and stored in cell array YP.This is run as an iteration of one parameter at a time, and then subsequently with the initial conditions changed by their individual perturbations. Debugging –this stage takes the most time in the parameter estimation process,as each perturbation simulation takes as longas a singlerun of run_sim as used in the programme before. Any trail runs of the user’s specific codeto debug problems should avoid this section of the code until necessary dueto the largetime expenditure (A2) F and G should haveno null columns, and to test for this the user should be lookingatthe H matrix computed after the simulationshavetaken place. The H matrix is the responsegradient πœ•π‘¦( 𝑑 π‘˜) 𝛿𝛩 (9). q, the variablethatdefines the numerator of H, is evaluated by taking the difference of the perturbed solution matrix YP at each time step, and the previous iteration solution matrix Y. 𝛿𝛩 is simply the numerical changefor each parameter (par_del) and defines the denominator of the response gradient. This definition is useful to know, as the H matrix should in theory have no null columns due to the difference in solution never yieldingexactly zero. If a column does return a null solution, then either ο‚· The parameter step is not defined or is zero ο‚· The parameters have not been defined correctly and the optimiser does not recognisethem. (7) (8) (9)
  • 12. 50 100 150 200 250 300 350 400 450 500 550 10 20 30 Pitchangle (deg.) 090622_20ms_1dof_ramp_part2_OEM Trim curve with data Exp Trim 50 100 150 200 250 300 350 400 450 500 550 -100 -50 0 50 Pitchrate (deg./s) 50 100 150 200 250 300 350 400 450 500 550 0 1 2 It is worth double checkingthese variablesand any other inputs that can influencethe definition of the parameters, as this is the most common error to have duringthe PE process. Now that the responsegradient has been established,the laststep of the function is to define F and G through simple linear algebra,with the new values added onto the previous each iteration. 𝐻 = πœ•π‘¦(𝑑 π‘˜ ) 𝛿𝛩 improv – the optimisation segment of the code is selected using run.method_opt, choosingeither improv or LM_method for the Gauss-Newton or Levenberg-Marquardt method respectively. Either method is acceptableand [1] explains thesubtle differences very well. Assuminga fully populated F matrix,its inversecan be calculated.The factthat F is symmetric and positive-definite can be used to the situation’s advantage.Numerical inversionscan beinaccurateespecially when dealingwith large batches of data,therefore the code makes use of a Cholesky factorisation to create the upper-triangular matrix (UTM) needed to create an inversion [4].The chol function does this efficiently and is integral to the MATLAB script,requiring no path definition.The essential matrix of parameter changes (𝛿𝛩) is described by delPar and is the explicitly the inverseof F multiplied by G. Using the Cholesky method, this calculation isdoneby dividingtheUTM by its transpose, then multiplyingthis by G. 3.2.2 Additional Calculations As the linesearch segment is turned on (run.line_search = 1), the directional optimisation routineis allowed to take place.minf_quad is responsiblefor the coremathematics involved in this process,and the user should refer to [5] for further information. minf_quad yields an updated parameter vector which is used as the final output of the function. Conditions for optimality for the variablesarestored using chk_lub_opt and any free parameters are dealtwith given they exist. The updated parameter vector is an output of improv and is fed back into ml_oem_func for reassembly in the main parameter file.Both the original and latestmatrices arestored, the final parameter estimates, standard deviations and correlation coefficients areprinted, then convergence plots aredrawn in run_optimiser using plot_convergence_and_param_deviations, completing PE phase 7. static_optimiser – run using PE_control phase 8, this segment of functions generates trim points from the experimental data and the numerical run wherever the motion of the inputs and outputs aresupposed to be static. For example, usingthe β€˜ramp_lin’ property in the run object, a static pointwould be generated for every step change in the elevator ramp – every 10 seconds in the experiment. The new points are ο‚· x_obs - the maximum and minimum of the observation variables for each static section ο‚· t_new - the midpoints in time of each of the static sections ο‚· Uinp_new – the mean of the inputs in each static section. The new vectors are then used in perform_trim to revaluatethe F and G matrices,to output a new estimate of the parameters and a new vector of the solution states x_new. This completes the optimisation iteration and the cycleis repeated inside static_optimiser. (9) Figure 5 –trim points overlaid on experimental data
  • 13. 3.3 Post-processing PE phase 9 can be run to save the parameter values that have resulted from a convergence, and sent to the global parameter fileusingPEphase 10. Through to PE phase19, various plottingfunctions can becalled to display and compare the data that has been processed.The user can chooseto change and adapt anythingin this section with no consequence to the final parameters in the output of the estimation. 4 Filter Error Method 4.1 Introduction The user should take accountfor the factthat the OEM used above directly accounts for turbulencein the experiment: the input variables Uinp aremeasures of the wind components and arefed directly into the estimation routine with littlerequirement to alter it. However, this approach relies on the measurement of said variables beingboth precise and accurate, as both the wind angles and aerodynamic derivatives arecalculated usingthis data.In practice,the process of setting up and recordingof Vt may not be easy or possible,therefore it would be useful to all parties to have the capability of mathematically modellingturbulenceand estimatingparameters from this data. The complication thatensues from this difference is however not trivial. π‘₯Μ‡ = 𝐴π‘₯( 𝑑) + 𝐡𝑒( 𝑑) + 𝐹𝑀( 𝑑) + 𝑏 π‘₯, π‘₯( 𝑑0 ) = 0 𝑦( 𝑑) = 𝐢π‘₯( 𝑑) + 𝐷𝑒( 𝑑) + 𝑏 𝑦 𝑧( 𝑑 π‘˜ ) = 𝑦( 𝑑 π‘˜ ) + πΊπœ—( 𝑑 π‘˜ ), π‘˜ = 1,2 … , 𝑁 The non-measureable process noiseis included in the state equations as a noisedistribution matrix β€˜F’(9), and as a resultthe system becomes stochastic – unpredictabledue to the influenceof a randomvariable [6].An estimator is required to generate the values of the state at each time period, therefore states get β€˜propagated’, not integrated [2]. This is a key difference that underpins filter error methods. 𝐽( 𝛩, 𝑅) = 1 2 βˆ‘ [𝑧( 𝑑 π‘˜ ) βˆ’ 𝑦̃(𝑑 π‘˜ 𝑁 π‘˜=1 )] 𝑇 π‘…βˆ’1 [𝑧( 𝑑 π‘˜ ) βˆ’ 𝑦̃( 𝑑 π‘˜ )] 𝑦̃, the output of the system incorporatingthepredicted states is the firstthing that must be calculated for the cost function to be optimised. To do this,a classical linear quadraticestimator (LQR) is required: a Kalman filter [12] provides everything that is required and is flexibleenough to be extended for non-linear equations,and works in a two-step routine: Prediction π‘₯Μƒ( 𝑑 π‘˜+1 ) = 𝑓𝑛( 𝛷, 𝛹) 𝑦̃( 𝑑 π‘˜ ) = 𝑓𝑛( π‘₯Μƒ, 𝑒) Correction π‘₯Μ‚( 𝑑 π‘˜ ) = π‘₯Μƒ( 𝑑 π‘˜ ) + 𝐾[𝑧( 𝑑 π‘˜ ) βˆ’ 𝑦̃( 𝑑 π‘˜ )] K, the Kalman Gain Matrix,can be formulated from C, P and R, the observation matrix,the state prediction errors and the covariancematrix of the squareerrors respectively. Whereas the calculation of R in the OEM was done usingan integrator and matrix algebra,the stochastic natureof the equations means the prediction error must be taken into accounthere as well,resultingin the equation 𝐾 = 𝑃𝐢 𝑇 π‘…βˆ’1 𝑅 = 𝐺𝐺 𝑇 + 𝐢𝑃𝐢 𝑇 This simplestructure(15) (16) makes up the skeleton of the FEM, but the formulation of the prediction error matrix is again not trivial and involves somecomplicated arithmetic. The importanceof this initial formulation should notbe understated; however the application of the process to non-linear equations is far moreuseful, therefore the key (9) (10) (11) (12) (13a) (13b) (14) (15) (16) (17)
  • 14. differences shall beexplained here in addition to the linear counterpart, as the code used in the programme is built upon non-linear stateequations (17) (18). π‘₯Μ‡( 𝑑) = 𝑓[ π‘₯( 𝑑), 𝑒( 𝑑), 𝛽] + 𝐹𝑀(𝑦) π‘₯( 𝑑0 ) = π‘₯0 𝑦( 𝑑) = 𝑔[π‘₯( 𝑑), 𝑒( 𝑑), 𝛽] The difficulty compared to linear systems is in the way the states and the costgradients are computed. The numerical method of differentiation used in the OEM is applicableto the non-linear caseONLY when a firstorder approximation is made of the state and measurement equations.Thankfully,the equations used in Pattinsons casearealready first order and therefore the approximation is exact.If the system model is time invariantor quasi -timeinvariant,a steady state as opposed to a time variant filter can be used for the state estimation:this is the process developed in the programme. By usingthe system equations described abovein the general cost function (12), the non-linear extended Kalman filter algorithmcan be administered,in the key steps described below: 1) Specify some startingvalues for the parameter vector (𝛩) consistingof parameters appearingin the system functions f and g, initial conditionsx0 and elements of the process noisedistribution matrix F. 2) Specify suitablestartvalues for or generate an estimate of R. 3) Do the state estimation by applyingthe extended Kalman filter – computing gain matrix K, numerical integration (propagation) of the state equations and computation of the predicted observation variables 𝑦̃. 4) Generate R classically. 5) Apply Gauss-Newton/Levenberg-Marquardt optimisation to update𝛩. 6) Repeat until converged. 4.2 Coding procedure ml_fem_func – called fromrun_optimiser in placeof the OEM function, this function starts by making an initial estimate of the R matrix usingthe method found in the OEM: integration of the state equations and the determinant/inverse of the residuals(errors).This istheonly operation and output of costfun_fem. The next call is to gainmat to calculatethe Kalman gain matrix for the current costvalues. gainmat – although the non-linear stateequations arefunctions (f and g), the elements of the system (A and C) remain in matrix form as in (9) however they must approximated due to the stochastic reasoningdescribed above. The approximation is oneof central difference, hence sysmatA and sysmatC create A and C respectively by evaluating the sum of the state equations at two discrete points a small perturbation in statevaluebetween each other, then dividingby the absolutevalueof this difference. x0 is updated at each PE iteration to make this approximation accurateeach time. 𝐴 = (π‘₯Μƒ2(𝑑 π‘˜) βˆ’ π‘₯Μƒ1(𝑑 π‘˜)) 𝑑π‘₯ The state prediction error covariancematrix element of K must next be calculated,and is done so by solvinga Ric cati equation: (20) 𝐴𝑃 + 𝑃𝐴 𝑇 βˆ’ 1 βˆ†π‘‘ 𝑃𝐢 𝑇 π‘…βˆ’1 𝐢𝑃 + 𝐹𝐹 𝑇 = 0 The Riccati Equation – a firstorder ordinary differential equation thatis quadratic in theunknown function π’šβ€²( 𝒙) = 𝒒 𝟎 ( 𝒙) + 𝒒 𝟏 ( 𝒙) π’š( 𝒙) + 𝒒 𝟐 ( 𝒙) π’š 𝟐 (𝒙) where q0 and q2 arenot equal to zero. If q0 were zero, the equation would be a Bernoulli equation,and q2 being zero would reduce the equation to a firstorder ODE. [7] The adaption of the solution to a classical ODEformulation is thatthere are many solution methods to choosefrom that have been proven effective and where efficient coding already exists.gainmatmakes use of β€˜Potters Method’, which does not requirederivation here, but itis enough to know that itis based on eigenvalue decomposition [1]. The rest of the filefollows a standard Potters Method, and hence P is calculated,allowingthe output K to be compiled from P, C and R usingsimplematrix algebra: 𝐾 = 𝑃𝐢 𝑇 π‘…βˆ’1 (18) (19) (20) (15)
  • 15. ml_fem_func (cont) – the precomputed valueof the F matrix is corrected usingthe new valueof R estimated in gainmat usinga halvingsequenceto check for intermediate divergence and prevent it. Once the pre-calculation checks have been completed to ensure divergence does not occur,the gradients matrices of the costfunction (F and G) can be calculated. gainmat_pert calculates theK matrix for a small perturbation in the matrix of parameters to be estimated (THETA) for use in the linearization approximation when using gradFG. This is exactly the same formulation as in the OEM but with the difference that 𝑦̃ is used instead of y. After this calculation,itis possiblefor the parameters to be updated usingthe quasi-linearization approach in (14),therefore a second gain matrix procedure needs to occur to calculatethe costfunction without the initial estimates and savethe new parameters. The sequence of ml_fem_func is described below for use in (14): Kgain (initial estimate) Β¦ Kgain (perturbations) Β¦ Kgain (new parameters) The current cost is carried through into run_optimiser where the code continues in the same way as before, which concludes the FEM inclusion in theprocess once the iterations havecaused convergence. 5 BifurcationAnalysis 5.1 Introduction The state equations that were used for the numerical simulation stagein this programme have many more applications. Continuation and Bifurcation methods arepowerful tools in the analysis of many flightdynamics stability problems, and make use of the state equations to derive the steady states of the model they present. A continuation creates an approximatesolution to a set of differential equations given an arbitrary initial condition [8] very much like a time integration, with the key difference that time is not the variablebeing changed. This β€˜continuation parameter’ can be any input into the system given ithas more than a null effect; as an example, the elevator anglein Pattinsons experiment [2]. The parameter increased or decreased in sequence, and the output of the state equations recorded. The field of study of Bifurcations isrich and varied,with many articles and books capableof describingthebas ic concept and further details [8]. This partof the guide will help the user understand the set up process and run their own continuation using MATCONT. Integral to the programme is MATCONT 2.5.1, a continuation programme with a vastcapability for dealingwith different types of state equation in the input. Due to the knowledge of the type of output expected, the run is split into two parts:equilibriumcontinuation and a limitcyclecontinuation fromthe transition point. Note: this is not the most updated version of MATCONT. Newer versions exist with a helpful GUI to help navigate the mainframe, which the user can download if interested, but the two versions are not simply β€˜copy-and-paste’ acceptable. The point of transition between an equilibrium(or otherwise) state and a limitcycleis known as a β€˜Hopf point’ (figure 6), which occurs due to a pair of complex conjugate eigenvalues crosses into the positiveplaneof the real axis.[8] 5.2 MATCONT PE_control phase22 and 23 define the equilibriumand limitcyclesegments of the continuation respectively. 5.2.1 Equilibrium plot_bf_diagram – this function is separatefrom any of the continuation subsections:itis responsiblefor plottingthe experimental bifurcation diagramrecorded in the data matrix Bigmat. Entries can be changed to plotwhatever the user wants,however in the current setting the function plots elevator angle againstpitch angle. The output of the function is the figurehandle ifigure, a singlevaluefed into MATCONT to ensure the continuation is overlaid. run_equillibrium_continuation – the user must firstdefine the continuer directories and put them on the current path. Insidethe β€˜cd’ and β€˜path’ inputfield,the origin directory mustbe set to wherever the files were downloaded to (i.e. β€˜C:DocumentsPE_download…’), allowingaccessto the MATCONT basecode. Results will besaved in a sub-directory β€˜Results_new>Continuation_results’ which the programme will create,with filenames of run.result_file with the tag β€˜results_bf_diag’ as set by the code in line10 of this function. MATCONT keeps its inputand output data in one .mat filelabelled β€˜S’ (table) S Description
  • 16. x points on the curve v tangent vectors along the curve s found singularities h continuation process variables f phase response curve for limit cycles Table 5 –description ofthe elements in S If this filealready exists,then the continuer will simply usethis fileto run the continuation and update the attached results file.If the filedoesn’t exist,the input conditions mustbe set up – this starts at line39. Options: 1DOF_pitch_only Β¦ 2DOF_pitch_and_heave 1DOF – the pre-processingof the data begins by setting Uinp (dVt) to 0 then creatinga new matrix p of the saved parameters and external inputs concatenated together. This matrix is a vector fileof singlevalues,not a matrix with every step included.This is different to how the PE stages ran and the user must be aware of this difference. The activeparameter β€˜ap’ is the continuation parameter and is defined as 11 – the 11th entry in β€˜p’, which is the elevator angleinput. The choice of continuation parameter should be established here. Next, the state equations arespecified, and nested function β€˜@manorig1D’ called to manipulatethem into a useableform. @manoorig1D – this simplefunction sets the matrix state equations up for use in point by point analysis β€“β€˜dydt’ is the unintegrated state variables vector.The second function attached in the filesimply evaluates the state equations over a time period. This is an attempt to accountfor the difficulttime dependency that is incorporated into the state equations (A3i) init_EP_EP – the equations and parameters must be set in the format MATCONT requires.This function defines ea ch parameter within the global variables thatMATCONT recognises,and outputs a single initial condition vector,and a tangent vector for the startingpoint. run_equillibrium_continuation (cont) – the next stage of this function is to establish theoptions that MATCONT refers to when initializingits coreprocedures (Table5). The continuer stores the handleto the options in β€˜cds.options’. Option Description Value MaxNumPoints maximum number of points on the curve 100 MaxNewtonIters maximum number of Newton-Raphson iterations before switchingto Newton-Chords in the corrector iterations 200 MaxCorrIters maximum number of correction iterations 20 VarTolerance tolerance of coordinates 1e-8 FunTolerance tolerance of function values 1e-8 TestTolerance tolerance of test functions 1e-4 MoorePenrose 1/0 indicatingthe use of the Moore-Penrose continuation as the Newtonlike corrector procedure 1 Increment the increment to compute firstorder derivatives numerically 1e-6 Backward 1/0 indicatingthe direction of the continuation 0 MaxStepSize the maximum stepsize 3e-2 MinStepSize the minimum stepsize to compute the next point 1e-12 InitStepSize the initial stepsize 1e-12 Eigenvalues 1/0 indicatingthe computation of the eigenvalues 1 Singularities 1/0 indicatingthe presence of a singularity matrix 1 Adapt number of points after which to call the adapt-function 1 Table 6 –description ofinput options for MATCONT from manual [13] Singularities mustbe set to 1 as the continuation needs to recognise the Hopf point which will occur when the limit cycle(LC) starts.MaxNumPoints has a direct correlation with the time taken to process the section, therefore take carewhen choosingmore points.For the equilibrium continuation,fewer points are required as the local variation is low.
  • 17. cont is called next – this is the continuer stored in the MATCONT files and has no need to be changed. A call to this file will run a continuation usingthe options,initial conditions and equations handle,and will output an S structure. The results aresaved and the function ended. The final curveis plotted againstthe experimental continuation diagramfor reference. 5.2.2 Limit Cycle run_LC_cont_from_hopf – Sincethe equilibriumcontinuation hasalready been run, the S structure exists and the Hopf point has been labelled and saved in S.s,meaning the preliminary 65 lines of code can be neglected, as they existfor cases where the LC has been previously computed. The same continuation code is used to run the sequence; however the options filewhich is defined in β€˜cds’ is different. The Hopf point labels mustalso bedefined so the continuer knows where to start: β€˜ntst’, β€˜ncol’ and β€˜hopf_pt’ must all bedefined by the user and must match the labels given in the output of the equilibriumcontinuation. For example, β€˜hopf_pt=2’ will causethe β€˜x’ solution atthe Hopf pointwith label 2 to become the startingvector. Once this is done, the continuer must be told that the continuation is periodic and must be adapted to accountfor this. init_H_LC – as well as setting a MATCONT format, an initial cyclefromthe Hopf point detected on the equilibrium curve must be calculated.The same tangent vector and initial conditions areoutputted, however the 3 labels defined by the user must be stated in the input. The continuer is then started again usingβ€˜cont’, the results plotted, and the results saved in >Continuation_results. PE_control can be followed to make use of the different plotting functions,as well as run a 2 parameter bifurcation usingthe lasttwo phases. This concludes the continuation phaseof the code, as well as the whole programme. The user is nowleft with a parameter filewith the estimates made by either the OEM or the FEM, data for plottingthe numerical simulation of the state equations,and bifurcation curvethat can be overlaid onto experimental data. Havingrun this code successfully,theuser will nowhave knowledge of several tools thatcan be extremely useful in the post processingof dynamical tests on aircraft.The limitto 1DOF in the examples provided by no means is the limit of either the Parameter Estimation or Continuation code, and many examples existwithin the original codefrom Jategaonkar [1] and in the MATCONT folder which the user is encouraged to try. Figure 6 –continuation curve overlaid on experimental data -18 -16 -14 -12 -10 -8 -6 -4 -2 5 10 15 20 25 30 35 40 Hawk elevator (deg.) Pitchangle(deg.)
  • 18. Appendix A1 State Space Formulation – 1DOF A simpleexample to help the user grasp the concept of writingequations of motion: example used mirrors the equations of motion of the manoeuvre rigin [2]. 1) Second order ODE that describes a general spring-massdamper 𝐼 𝑦𝑦 πœƒΜˆ + 𝐢 πœƒ πœƒΜ‡ + πΎπœƒ πœƒ = 𝑀 2) This equation is adapted to the manoeuvre rig – the assumptions includezero dampingand no friction,and an inversion changingthe moment into its coefficientform. πœƒΜˆ = 𝑀 𝐼 𝑦𝑦 πœƒΜˆ = 𝐢 𝑀 𝐼 𝑦𝑦 = π‘žΜ… 𝑆𝑐̅ 𝑀 𝐼 𝑦𝑦 3) A second order variabletakes longer to integrate than a firstorder; therefore the state spaceform is required to changethe problem to one of the firstorder. An arbitrary variable y is defined to equal the derivativeof the state variable,then this variabledifferentiated to equal the double derivative.A third and final equation 𝑋̇ (see [2]) is added as itis a firstorder differential equation that can be integrated, and needs to be referred to in the same way as the 1DOF variable. 𝑦 = πœƒΜ‡ 𝑦̇ = πœƒΜˆ = 𝐢 𝑀 𝐼 𝑦𝑦 Μ‡ 𝑋̇ = 𝑓𝑛(𝑋, 𝛼) 4) A singlestatevector is formed of the three firstorder differential equations – this is much quicker to integrate and formulate usingMATLAB. π‘ π‘‘π‘Žπ‘‘π‘’ π‘’π‘žπ‘’π‘Žπ‘‘π‘–π‘œπ‘›π‘  = [ 𝑦 𝑦̇ 𝑋̇ ] = π‘₯π‘‘π‘œπ‘‘ A2 Administering trails and tests Trails and tests on the code are likely to be desired by the user for both debugging and adaption purposes; however it is not immediately obvious how to do so. The structure of PE_control means a workspace is notsaved in-between each of its stages – in factit is entirely internal and functions arewritten to keep it the programme this way. The user must run functions individually and work around the processingproblems that occur. The firstplaceto startin β€˜opening up’ the code is to create a usableworkspace: 1) Open the PE_control run file(β€˜run_TC13’), highlightthe stage 1 control, rightclick and selectβ€˜Evaluate Section’, or press F9. This pre-processes the data to get it into a useableformat, and creates the run object to be sent to the workspacefor use by other functions. 2) Open test_Define_case. This function will takethe output vector from Define_case and relabel each entry as an individual variablewith the same name. Every function called after Define_case works off some derivation of these variables thereforeanything can be run with a visible output. Tests can be simply runningdifferent functions to see their numerical output: in this casewhen the function is partof a loop, other inputvectors must be created to simulatethe state values atthat particular iteration. Individual testfiles can also becreated that extract some key partof the code to run without havingto run the entire file.Some of these are listed belowfor comparison: ο‚· test_xdot_solver ο‚· test_run_sim ο‚· test_ode ο‚· test_Define_case (21) (22) (23) (24)
  • 19. A3 Equations and Inputs Figure 8 –time series ofmeasured inputs in Uinp vector A4 Definitions Cost function - A costfunction 𝐢(π‘ž)is a function ofπ‘ž, which calculates theminimum cost for producing π‘ž units. Handle – A function handleis a MATLAB valuethat provides a means of callinga function indirectly. Measurement noise – the noisein takingmeasurements of the inputvalues in Uinp. Procedure noise – the noiseinherent to the experiment (turbulence). 0 100 200 300 400 500 600 -20 -10 0 Time (s) de 0 100 200 300 400 500 600 20.4 20.6 Time (s) Vt 0 100 200 300 400 500 600 240 250 260 Time (s) qbar 0 100 200 300 400 500 600 -0.5 0 0.5 Time (s) dVt Figure 7 –ODEsolver sequence for example
  • 20. References [1] Jategaonkar, R. V. (2006). Flight Vehicle System Identification (1st ed.). AmericanInstitute of Aeronautics and Astronautics. [2] Pattinson, J., Lowenberg, M. H., & Goman, M. G. (2013). Investigationof Poststall Pitch Oscillations of an Aircraft Wind-Tunnel Model. Journal of Aircraft, 50(6), 1843–1855. doi:10.2514/1.C032184 [3] Pattinson, J. (2010). Development andEvaluationof a WindTunnelManoeuvre Rig, (November). [4] MATHWORKS. (2015). Choleskyfactorization. Available: http://uk.mathworks.com/help/matlab/ref/chol.html. Last accessed 18/8/2015. [5] Elmer Forsythe, G., Malcolm, M. A., & Moler, C. B. (1977). Computer Methods of Mathematical Computations. (Prentice-Hall, Ed.) (1st Editio., p. 200). [6] Origlio, Vincenzo. "Stochastic." From MathWorld--AWolframWebResource, created byEric W. Weisstein. http://mathworld.wolfram.com/Stochastic.html [7] Weisstein, Eric W. "Riccati DifferentialEquation." From MathWorld--A WolframWebResource. http://mathworld.wolfram.com/RiccatiDifferentialEquation.html [8] Thompson, J. M. ., & Stewart, H. . (2002). Nonlinear Dynamics andChaos (Second., pp. 106–131). [9] MATHWORKS. (2015). Object Orientated Programming inMATLAB. Available: http://uk.mathworks.com/discovery/object- oriented-programming.html. Last accessed20/06/2015. [10] Chia-Hui Chen, course materials for 14.01 Principles ofMicroeconomics, Fall 2007. MITOpenCourseWare (http://ocw.mit.edu), Massachusetts Institute of Technology [11] MATHWORKS. (2015). OrdinaryDifferential Equations. Available: http://uk.mathworks.com/help/matlab/math/ordinary- differential-equations.html. Last accessed08/08/2015. [12] Welch, G., & Bishop, G. (2006). An Introductionto the KalmanFilter. InPractice, 7, 1–16. doi:10.1.1.117.6808 [13] W. Govaerts, Y. a. K., & V. De Witte, A. Dhooge, H.G.E. Meijer, W. Mestrom, a. M. R. andB. S. (2011). MATCONT and CL MATCONT: Continuation toolboxes inmatlab. …Gent, Belgium and…, 1–100. Retrieved from http://uploads.tombertalan.com/12fall2012/502cbe502/hw/hw3/manual.pdf