How Online Parameter Estimation Differs from Offline Estimation
Online estimation algorithms estimate the parameters of a model when new data is available during the operation of the model. In offline estimation, you first collect all the input/output data and then estimate the model parameters . Parameter values estimated using online estimation can vary with time, but parameters estimated using offline estimation do not.
To perform offline estimation, use commands such as arx
, pem
, ssest
, tfest
, nlarx
, and the System Identification app.
To perform online parameter estimation in Simulink®, use the Recursive Least Squares Estimator and
Recursive Polynomial Model Estimator
blocks. For online estimation at the command
line, use commands such as recursiveARX
to create a System object™, and then use step
command to update the model
parameters.
Online estimation differs from offline estimation in the following ways:
Model delays — You can estimate model delays in offline estimation using tools such as
delayest
(see Determining Model Order and Delay). Online estimation provides limited ability to estimate delays. For polynomial model estimation using the Recursive Polynomial Model Estimation block or the online estimation commands, you can specify a known value of the input delay (nk). If nk is unknown, choose a sufficiently large value for the number of coefficients of B (nb). The number of leading coefficients of the estimated B polynomial that are close to zero represent the input delay.Data preprocessing — For offline estimation data preprocessing, you can use functions such as
detrend
,retrend
,idfilt
, and the System Identification app.For online estimation using Simulink, use the tools available in the Simulink environment. For more information, see Preprocess Online Parameter Estimation Data in Simulink.
For online parameter estimation at the command line, you cannot use preprocessing tools in System Identification Toolbox™. These tools support only data specified as
iddata
objects. Implement preprocessing code as required by your application. To be able to generate C and C++ code, use commands supported by MATLAB® Coder™. For a list of these commands, see Functions and Objects Supported for C/C++ Code Generation (MATLAB Coder).Resetting of estimation — You cannot reset offline estimation. Online estimation lets you reset the estimation at a specific time step during estimation. For example, reset the estimation when the system changes modes or if you are not satisfied with the estimation. The reset operation sets the model states, estimated parameters, and estimated parameter covariance to their initial values.
To reset online estimation in Simulink, on the Algorithm and Block Options tab of the block parameters, select the appropriate External reset option. At the command line, use the
reset
command.Enabling or disabling of estimation — You cannot selectively enable or disable offline estimation. You can use preprocessing tools to remove or filter certain portions of the data before the estimation. Online estimation lets you enable or disable estimation for chosen time spans. For example, suppose that the measured data is especially noisy or faulty (contains many outliers) for a specific time interval. Disable online estimation for this interval.
To enable or disable estimation in Simulink, on the Algorithm and Block Options tab of the block parameters, select the Add enable port check box.
At the command line, use the
EnableAdaptation
property of the System object created using online estimation commands, such asrecursiveARMAX
andrecursiveLS
. Even if you setEnableAdaptation
tofalse
, execute thestep
command. Do not skipstep
to keep parameter values constant because parameter estimation depends on current and past input/output measurements.step
ensures that past input-output data is stored, even when it does not update the parameters.