Estimate the parameters of an ARX or AR model.
Syntax
th = arx(z,nn)
th = arx(z,nn,maxsize,T)
Description
The parameters of the ARX model structure

are estimated using the least-squares method.
Matrix z contains the output-input data z = [y u] where y and u are column vectors. nn is given as
nn = [na nb nk]
defining the orders and delay of the ARX model. See Section 6 in the Tutorial for exact definitions of the orders and delays.
th is returned as the least-squares estimates of the parameters, stored in theta format.
With z = y and nn = na, an AR model of order na for y is computed:

Models with several inputs

are handled by allowing u to contain each input as a column vector,
u = [u1 ... unu]
and by allowing nb and nk to be row vectors defining the orders and delays associated with each input.
Models with several inputs and several outputs are handled by allowing nn to contain one row for each output number. See "Defining Model Structures" on page 3-29 in the User's Guide for exact definitions.
The optional auxiliary parameters maxsize and T are explained under
auxvar.
When the true noise term
in the ARX model structure is not white noise and na is nonzero, the estimate does not give a correct model. It is then better to use armax, bj, iv4, or oe.
Examples
Here is an example that generates and estimates an ARX model:
A = [1 -1.5 0.7]; B = [0 1 0.5];
th0 = poly2th(A,B);
u = idinput(300,'rbs');
y = idsim([u,randn(300,1)],th0);
z = [y,u];
th = arx(z,[2 2 1]);
Algorithm
The least-squares estimation problem is an overdetermined set of linear equations that is solved using the MATLAB \ operator.
The regression matrix is formed so that only measured quantities are used (no fill-out with zeros). When the regression matrix is larger than maxsize, the normal equations are formed in a for-loop and subsequently solved.
See Also
auxvar, ar, iv, iv4, theta
[ Previous | Help Desk | Next ]