This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Estimate Polynomial Models at the Command Line

 Prerequisites

Using arx and iv4 to Estimate ARX Models

You can estimate single-output and multiple-output ARX models using the arx and iv4 commands. For information about the algorithms, see Polynomial Model Estimation Algorithms.

You can use the following general syntax to both configure and estimate ARX models:

% Using ARX method
m = arx(data,[na nb nk],opt);
% Using IV method
m = iv4(data,[na nb nk],opt);

data is the estimation data and [na nb nk] specifies the model orders, as discussed in What Are Polynomial Models?.

The third input argument opt contains the options for configuring the estimation of the ARX model, such as handling of initial conditions and input offsets. You can create and configure the option set opt using the arxOptions and iv4Options commands. The three input arguments can also be followed by name and value pairs to specify optional model structure attributes such as InputDelay, IODelay, and IntegrateNoise.

To get discrete-time models, use the time-domain data (iddata object).

Note

Continuous-time polynomials of ARX structure are not supported.

For more information about validating you model, see Validating Models After Estimation.

You can use pem or polyest to refine parameter estimates of an existing polynomial model, as described in Refine Linear Parametric Models.

For detailed information about these commands, see the corresponding reference page.

Tip

You can use the estimated ARX model for initializing a nonlinear estimation at the command line, which improves the fit of the model. See Initialize Nonlinear ARX Estimation Using Linear Model.

Using polyest to Estimate Polynomial Models

You can estimate any polynomial model using the iterative prediction-error estimation method polyest. For Gaussian disturbances of unknown variance, this method gives the maximum likelihood estimate. The resulting models are stored as idpoly model objects.

Use the following general syntax to both configure and estimate polynomial models:

m = polyest(data,[na nb nc nd nf nk],opt,Name,Value);

where data is the estimation data. na, nb, nc, nd, nf are integers that specify the model orders, and nk specifies the input delays for each input.For more information about model orders, see What Are Polynomial Models?.

Tip

You do not need to construct the model object using idpoly before estimation.

If you want to estimate the coefficients of all five polynomials, A, B, C, D, and F, you must specify an integer order for each polynomial. However, if you want to specify an ARMAX model for example, which includes only the A, B, and C polynomials, you must set nd and nf to zero matrices of the appropriate size. For some simpler configurations, there are dedicated estimation commands such as arx, armax, bj, and oe, which deliver the required model by using just the required orders. For example, oe(data,[nb nf nk],opt) estimates an output-error structure polynomial model.

Note

To get faster estimation of ARX models, use arx or iv4 instead of polyest.

In addition to the polynomial models listed in What Are Polynomial Models?, you can use polyest to model the ARARX structure—called the generalized least-squares model—by setting nc=nf=0. You can also model the ARARMAX structure—called the extended matrix model—by setting nf=0.

The third input argument, opt, contains the options for configuring the estimation of the polynomial model, such as handling of initial conditions, input offsets and search algorithm. You can create and configure the option set opt using the polyestOptions command. The three input arguments can also be followed by name and value pairs to specify optional model structure attributes such as InputDelay, IODelay, and IntegrateNoise.

For ARMAX, Box-Jenkins, and Output-Error models—which can only be estimated using the iterative prediction-error method—use the armax, bj, and oe estimation commands, respectively. These commands are versions of polyest with simplified syntax for these specific model structures, as follows:

m = armax(Data,[na nb nc nk]);
m = oe(Data,[nb nf nk]);
m = bj(Data,[nb nc nd nf nk]);

Similar to polyest, you can specify as input arguments the option set configured using commands armaxOptions, oeOptions, and bjOptions for the estimators armax, oe, and bj respectively. You can also use name and value pairs to configure additional model structure attributes.

Tip

If your data is sampled fast, it might help to apply a lowpass filter to the data before estimating the model, or specify a frequency range for the WeightingFilter property during estimation. For example, to model only data in the frequency range 0-10 rad/s, use the WeightingFilter property, as follows:

opt = oeOptions('WeightingFilter',[0 10]);
m = oe(Data, [nb nf nk], opt);

For more information about validating your model, see Validating Models After Estimation.

You can use pem or polyest to refine parameter estimates of an existing polynomial model (of any configuration), as described in Refine Linear Parametric Models.

For more information, see polyest, pem and idpoly.

Related Examples

More About