Online estimation algorithms estimate the parameters and states of a model when new data is available during the operation of the physical system. The System Identification Toolbox™ software uses linear, extended, and unscented Kalman filter algorithms for online state estimation. The toolbox uses recursive prediction error minimization algorithms for online parameter estimation.
Consider a heating and cooling system that does not have prior information about the environment in which it operates. Suppose that this system must heat or cool a room to achieve a certain temperature in a given amount of time. To fulfill its objective, the system must obtain knowledge of the temperature and insulation characteristics of the room. You can estimate the insulation characteristics of the room while the system is online (operational). For this estimation, use the system effort as the input and the room temperature as the output. You can use the estimated model to improve system behavior. Online estimation is ideal for estimating small deviations in the parameter values of a system at a known operating point.
Common applications of online estimation include:
Adaptive control — Estimate a plant model to modify the controller based on changes in the plant model.
Fault detection — Compare the online plant model with the idealized or reference plant model to detect a fault (anomaly) in the plant.
Soft sensing — Generate a "measurement" based on the estimated plant model, and use this measurement for feedback control or fault detection.
Verification of the experiment-data quality before starting offline estimation — Before using the measured data for offline estimation, perform online estimation for a few iterations. The online estimation provides a quick check of whether the experiment used excitation signals that captured the relevant system dynamics.
Online parameter estimation is typically performed using a recursive algorithm. To estimate the parameter values at a time step, recursive algorithms use the current measurements and previous parameter estimates. Therefore, recursive algorithms are efficient in terms of memory usage. Also, recursive algorithms have smaller computational demands. This efficiency makes them suited to online and embedded applications. For more information about the algorithms, see Recursive Algorithms for Online Parameter Estimation.
In System Identification Toolbox you can perform online parameter estimation in Simulink® or at the command line:
In Simulink, use the Recursive Least Squares Estimator and Recursive Polynomial Model Estimator blocks to perform online parameter estimation. You can also estimate a state-space model online from these models by using the Recursive Polynomial Model Estimator and Model Type Converter blocks together. You can generate C/C++ code and Structured Text for these blocks using Simulink Coder™ and Simulink PLC Coder™ softwares.
At the command line, use
to estimate model parameters for your model structure. Unlike estimation
in Simulink, you can change the properties of the recursive estimation
algorithm during online estimation. You can generate code and standalone
applications using MATLAB® Coder and MATLAB Compiler™ software.
When you perform online parameter estimation in Simulink or at the command line, the following requirements apply:
Model must be discrete-time linear or nearly linear with parameters that vary slowly with time.
Structure of the estimated model must be fixed during estimation.
is not supported during online parameter estimation. Specify estimation
output data as a real scalar and input data as a real scalar or vector.
You can perform online state estimation of systems at the command line and in Simulink:
In Simulink, use the Kalman Filter, Extended Kalman Filter, and Unscented Kalman Filter blocks to perform online state estimation of discrete-time linear and nonlinear systems. You can generate C/C++ code for these blocks using Simulink Coder software. For the Kalman Filter block, you can also generate Structured Text using Simulink PLC Coder software.
At the command line, use
unscentedKalmanFilter commands to estimate
states of discrete-time nonlinear systems. These commands implement
discrete-time extended Kalman filter (EKF) and unscented Kalman filter
(UKF) algorithms. For more information about the algorithms, see Extended and Unscented Kalman Filter Algorithms for Online
You can generate code and standalone applications using MATLAB Coder and MATLAB Compiler softwares.
When you perform online state estimation in Simulink or at the command line, the following requirements apply:
System must be discrete-time. If you are using the Kalman Filter block, the system can also be continuous-time.
is not supported during online state estimation. Specify estimation
input-output data as real scalars or vectors.
 Ljung, L. System Identification: Theory for the User. Upper Saddle River, NJ: Prentice-Hall PTR, 1999, pp. 428–440.
 Simon, D. Optimal State Estimation: Kalman, H Infinity, and Nonlinear Approaches. John Wiley and Sons Inc., 2006.