To troubleshoot online parameter estimation, check the following:
Check that you are using the simplest model structure that adequately captures the system dynamics.
AR and ARX model structures are good first candidates for estimating linear models. The underlying estimation algorithms for these model structures are simpler than those for ARMA, ARMAX, Output-Error, and Box-Jenkins model structures. In addition, these simpler AR and ARX algorithms are less sensitive to initial parameter guesses.
The more generic recursive least squares (RLS) estimation also has the advantage of algorithmic simplicity like AR and ARX model estimation. RLS lets you estimate parameters for a wider class of models than ARX and AR and can include nonlinearities. However, configuring an AR or ARX structure is simpler.
Consider the following when choosing a model structure:
AR and ARX model structures — If you are estimating a time-series model (no inputs), try the AR model structure. If you are estimating an input-output model, try the ARX model structure. Also try different model orders with these model structures. These models estimate the system output based on time-shifted versions of the output and inputs signals. For example, the a and b parameters of the system y(t) = b1u(t)+b2u(t-1)-a1y(t-1) can be estimated using ARX models.
For more information regarding AR and ARX models, see What Are Polynomial Models?.
RLS estimation— If you are estimating a system that is linear in the estimated parameters, but does not fit into AR or ARX model structures, try RLS estimation. You can estimate the system output based on the time-shifted versions of input-outputs signals like the AR and ARX, and can also add nonlinear functions. For example, you can estimate the parameters p1, p2, and p3 of the system y(t) = p1y(t-1) + p2u(t-1) + p3u(t-1)2 . You can also estimate static models, such as the line-fit problem of estimating parameters a and b in y(t) = au(t)+b.
ARMA, ARMAX, Output-Error, Box-Jenkins model structures — These model structures provide more flexibility compared to AR and ARX model structures to capture the dynamics of linear systems. For instance, an ARMAX model has more dynamic elements (C polynomial parameters) compared to ARX for estimating noise models. This flexibility can help when AR and ARX are not sufficient to capture the system dynamics of interest.
Specifying initial parameter and parameter covariance values are especially recommended for these model structures. This is because the estimation method used for these model structures can get stuck at a local optima. For more information about these models, see What Are Polynomial Models?.
Check the order of your specified model structure. You can under-fit (model order is too low) or over-fit (model order is too high) data by choosing an incorrect model order.
Ideally, you want the lowest-order model that adequately captures your system dynamics. Under-fitting prevents algorithms from finding a good fit to the model, even if all other estimation settings are good, and there is good excitation of system dynamics. Over-fitting typically leads to high sensitivity of parameters to the measurement noise or the choice of input signals.
Use inputs that excite the system dynamics adequately. Simple inputs, such as a step input, typically does not provide sufficient excitation and are good for estimating only a very limited number of parameters. One solution is to inject extra input perturbations.
Estimation data that contains deficiencies can lead to poor estimation results. Data deficiencies include drift, offset, missing samples, equilibrium behavior, seasonalities, and outliers. It is recommended that you preprocess the estimation data as needed.
For information on how to preprocess estimation data in Simulink®, 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).
Check the initial guesses you specify for the parameter values and initial parameter covariance matrix. Specifying initial parameter guesses and initial parameter covariance matrix is recommended. These initial guesses could be based on your knowledge of the system or be obtained via offline estimation.
Initial parameter covariance represents the uncertainty in your guess for the
initial values. When you are confident about your initial parameter guesses, and if
the initial parameter guesses are much smaller than the default initial parameter
10000, specify a smaller initial parameter
covariance. Typically, the default initial parameter covariance is too large
relative to the initial parameter values. The result is that initial guesses are
given less importance during estimation.
Initial parameter and parameter covariance guesses are especially important for ARMA, ARMAX, Output-Error, and Box-Jenkins models. Poor or no guesses can result in the algorithm finding a local minima of the objective function in the parameter space, which can lead to a poor fit.
Check that you have specified appropriate settings for the estimation algorithm. For example, for the forgetting factor algorithm, choose the forgetting factor, λ, carefully. If λ is too small, the estimation algorithm assumes that the parameter value is varying quickly with time. Conversely, if λ is too large, the estimation algorithm assumes that the parameter value does not vary much with time. For more information regarding the estimation algorithms, see Recursive Algorithms for Online Parameter Estimation.