System Identification Toolbox
  Go to function:
    Search    Help Desk 
n4sid    Examples   See Also

Estimate state-space models using a subspace method.

Syntax

TH = n4sid(z)
[TH,AO] = n4sid(z,order,ny,auxord,dkx,maxsize,T,'trace')

Description

The function n4sid estimates models in state-space form, and returns them in the theta format. It handles an arbitrary number of input and outputs, including the time series case (no input). The state-space model is in the innovations form:

TH: The resulting model in theta format. No covariance information about the uncertainty of the model is contained in TH.

AO: See under auxord below.

z: A matrix that contains the output-input data: z = [y u], where y and u are column vectors. In the multi-variable case, u and y contain one column for each output and input. In the time series case z = y.

order: The desired order of the state-space model. If order is entered as a row vector (like order = [1:10], which is the default choice), preliminary calculations for all the indicated orders are carried out. A plot will then be given that shows the relative importance of the dimension of the state vector. More precisely, the singular values of the Hankel matrices of the impulse response for different orders are graphed. You will be prompted to select the order, based on this plot. The idea is to choose an order such that the singular values for higher orders are comparatively small. If order = 'best', a model of "best" (default choice) order is computed, among the orders 1:10.

ny: The number of outputs in the data set z. Default is ny = 1.

auxord: An "auxiliary order" used by the algorithm. This can be seen as a prediction horizon, and it should be larger than the order. The default value is auxord = 1.2*order+3. The choice of auxord could have a substantial influence on the model quality, and there are no simple rules for how to choose it. If you enter auxord as a row vector (like auxord = [5:15]), models for all these values will be computed. The prediction error for each of the models are computed using the data z, and that value of auxord that minimizes the fit will be selected. This value is returned as the output argument AO. If the last given argument to n4sid is 'trace', information about the different choices of auxord will be given to the screen. Note that auxord can be chosen as a vector, only if order is a given value (no vector).

dkx: The argument dkx determines some additional structure of the matrices of the state-space model to be estimated. It is a row vector with three entries:

The entries refer to the matrices K, D, and the initial state X(0) of the state-space model given above.

k = 1 indicates that the K-matrix in the model (the Kalman Gain) will be estimated, while k = 0 means that this matrix will be fixed to zero. This will give a so called output error model.

d = 1 indicates that D-matrix in the model (the direct term from input to output) will be estimated, while d = 0 means that this matrix is fixed to zero. This also implies that there will be a delay of (at least) one sample between the input and the output.

x = 1 indicates that the initial state x(0) will be estimated and stored in the model TH, while x = 0 means that the initial state will be taken as zero. Note that the initial state is something that relates to the particular data set for which the model was estimated, and may not be relevant when the model is evaluated on a new set of data.

Default is

The optional variables maxsize and T are explained under AUXVAR.

trace: Letting the last input argument be 'trace', gives information to the command line about the choice of auxiliary order, in case this is given as a vector.

Algorithm

The function implements the methods described in P. Van Overschee and B. De Moor: N4SID:Subspace algorithms for the identication of combined deteministic-stochastic systems. Automatica, Vol. 30, No 1, pp. 75-93, 1994.

The algorithm is complemented with a separate linear least-squares step to re-estimate the matrices B, D, and X(0), which enter linearly.

Examples

Build a fifth order model from data with three inputs and two outputs. Try several choices of auxiliary orders. Look at the frequency response of the model. (Note that there will be no confidence intervals!)

Use the resulting model as initial values for estimating a state-space model of the same order using the prediction error method:

See Also

auxvar, canstart, pem, theta

[ Previous | Help Desk | Next ]