Create System object for online parameter estimation using recursive least squares algorithm
obj = recursiveLS
obj = recursiveLS(Np)
obj = recursiveLS(Np,theta0)
obj = recursiveLS(___,Name,Value)
Use the recursiveLS
command for parameter estimation with
realtime data. If all data necessary for estimation is available at once and you are
estimating a timeinvariant model, use mldivide, \
.
creates a System object™ for online parameter estimation of a default single output system that is
linear in estimated parameters. Such a system can be represented as:obj
= recursiveLS
y(t) = H(t)θ(t)+e(t).
Here, y is the output, θ are the parameters,
H are the regressors, and e is the whitenoise
disturbance. The default system has one parameter with initial parameter value
1
.
After creating the object, use the step
command to update model parameter estimates using recursive least
squares algorithms and realtime data. Alternatively, you can call the object directly.
For more information, see Tips.
also specifies the number of parameters to be estimated.obj
= recursiveLS(Np
)
also specifies the number of parameters and initial values of the parameters.obj
= recursiveLS(Np
,theta0
)
specifies additional attributes of the system and recursive estimation algorithm using
one or more obj
= recursiveLS(___,Name,Value
)Name,Value
pair arguments.
recursiveLS
creates a System object for
online parameter estimation of a single output system that is linear
in its parameters.
A System object is a specialized MATLAB^{®} object designed specifically for implementing and simulating dynamic systems with inputs that change over time. System objects use internal states to store past behavior, which is used in the next computational step.
After you create a System object, you use commands to process
data or obtain information from or about the object. System objects
use a minimum of two commands to process data — a constructor
to create the object and the step
command
to update object parameters using realtime data. This separation
of declaration from execution lets you create multiple, persistent,
reusable objects, each with different settings.
You can use the following commands with the online estimation System objects in System Identification Toolbox™:
Command  Description 

step  Update model parameter estimates using recursive estimation algorithms and realtime data.

release  Unlock the System object. Use this command to enable setting of nontunable parameters. 
reset  Reset the internal states of a locked System object to the initial values, and leave the object locked. 
clone  Create another System object with the same object property values. Do not create additional objects using
syntax 
isLocked  Query locked status for input attributes and nontunable properties of the System object. 
Use the recursiveLS
command to create an
online estimation System object. Then estimate the system parameters
(theta
) and output using the step
command
with regressors and incoming output data, H
and y
.
[theta,EstimatedOutput] = step(obj,y,H)
For recursiveLS
object properties, see Properties.
recursiveLS
System object properties
consist of readonly and writable properties. The writable properties
are tunable and nontunable properties. The nontunable properties cannot
be changed when the object is locked, that is, after you use the step
command.
Use Name,Value
arguments to specify writable
properties of recursiveLS
objects during object
creation. After object creation, use dot notation to modify the tunable
properties.
obj = recursiveLS; obj.ForgettingFactor = 0.99;

Number of parameters to be estimated, returned as a positive integer.
Default: 

Estimated parameters, returned as a column vector of real values.


Initial values of parameters, specified as one of the following:
If the initial parameter values are much smaller than
Default: 

Initial values of the outputs buffer in finitehistory estimation,
specified as The When If the initial buffer is set to Specify
Default: 

Initial values of the regressors buffer in finitehistory estimation,
specified as The When the If the initial buffer is set to Specify
Default: 

Estimated covariance
The interpretation of


Covariance of the initial parameter estimates, specified as one of the following:
Use only when
Default: 

Recursive least squares estimation algorithm used for online estimation of model parameters, specified as one of the following values:
Forgetting factor and Kalman filter algorithms are more computationally intensive than gradient and unnormalized gradient methods. However, they have better convergence properties. For information about these algorithms, see Recursive Algorithms for Online Parameter Estimation. These methods all use an infinite data history, and are available only
when
Default: 

Forgetting factor, λ, relevant for parameter estimation, specified as a scalar in the range (0,1]. Suppose that the system remains approximately constant over T_{0} samples. You can choose λ such that: $${T}_{0}=\frac{1}{1\lambda}$$
Typical choices of λ are in the range Use only when
Default: 

Enable or disable parameter estimation, specified as one of the following:
Default: 

Floating point precision of parameters, specified as one of the following values:
Setting
Default: 

Covariance matrix of parameter variations, specified as one of the following:
N is the number of parameters to be estimated.
Kalman filter algorithm treats the parameters as states of a
dynamic system and estimates these parameters using a Kalman filter.
Default: 

Adaptation gain, γ, used in gradient recursive estimation algorithms, specified as a positive scalar.
Specify a large value for
Default: 

Bias in adaptation gain scaling used in the
The normalized gradient algorithm divides the adaptation gain
at each step by the square of the twonorm of the gradient vector.
If the gradient is close to zero, this can cause jumps in the estimated
parameters.
Default: 

Data history type defining which type of recursive algorithm you use, specified as:
Algorithms with infinite history aim to produce parameter estimates that
explain all data since the start of the simulation. These algorithms still
use a fixed amount of memory that does not grow over time. The object
provides multiple algorithms of the Algorithms with finite history aim to produce parameter estimates that
explain only a finite number of past data samples. This method is also
called slidingwindow estimation. The object provides
one algorithm of the For more information on recursive estimation methods, see Recursive Algorithms for Online Parameter Estimation.
Default: 

Window size determining the number of time samples to use for the
slidingwindow estimation method, specified as a positive integer. Specify
Choose a window size that balances estimation performance with computational and memory burden. Sizing factors include the number and time variance of the parameters in your model. Always specify Window Length in samples, even if you are using framebased input processing.
Suitable window length is independent of whether you are using
samplebased or framebased input processing (see
Default: 

Option for samplebased or framebased input processing, specified as a character vector or string.
Your [theta,EstimatedOutput] = step(obj,y,H)
Default: 
Starting in R2016b, instead of using the step
command
to update model parameter estimates, you can call the System object with
input arguments, as if it were a function. For example, [theta,EstimatedOutput]
= step(obj,y,H)
and [theta,EstimatedOutput] = obj(y,H)
perform
equivalent operations.
step
 release
 reset
 clone
 isLocked
 Recursive
Least Squares Estimator  mldivide
 recursiveAR
 recursiveARX
 recursiveARMA
 recursiveBJ
 recursiveOE
 recursiveARMAX