# n4sid

Estimate state-space model using subspace method with time-domain or frequency-domain data

## Syntax

## Description

### Estimate State-Space Model

estimates a discrete-time state-space model `sys`

= n4sid(`tt`

,`nx`

)`sys`

of order
`nx`

using all the input and output signals in the timetable
`tt`

.

`sys`

is a model of the following form:

$$\begin{array}{l}\dot{x}(t)=Ax(t)+Bu(t)+Ke(t)\\ y(t)=Cx(t)+Du(t)+e(t)\end{array}$$

*A*, *B*, *C*,
*D*, and *K* are state-space matrices.
*u*(*t*) is the input,
*y*(*t*) is the output,
*e*(*t*) is the disturbance, and
*x*(*t*) is the vector of `nx`

states.

All entries of *A*, *B*, *C*, and
*K* are free estimable parameters by default. For dynamic systems,
*D* is fixed to zero by default, meaning that the system has no
feedthrough. For static systems (`nx = 0`

), *D* is an
estimable parameter by default.

You can use this syntax for SISO and MISO systems. The function assumes that the last
variable in the timetable is the single output signal. You can also use this syntax to
estimate a time-series model if `tt`

contains a single variable that
represents the sole output.

For MIMO systems and for timetables that contain more variables than you plan to use
for estimation, you must also use name-value arguments to specify the names of the input
and output channels you want. For more information, see `tt`

.

To estimate a continuous-time model, set `'Ts'`

to
`0`

using name-value syntax.

uses the time-domain or frequency-domain data in the data object
`sys`

= n4sid(`data`

,`nx`

)`data`

. Use this syntax especially when you want to estimate a
state-space model using frequency-domain or frequency-response data, or when you want to
take advantage of the additional information, such as data sample time or experiment
labeling, that data objects provide.

### Specify Additional Options

incorporates additional options specified by one or more name-value pair arguments. For
example, to estimate a continuous-time model, specify the sample time
`sys`

= n4sid(___,`Name,Value`

)`'Ts'`

as `0`

. Use the `'Form'`

,
`'Feedthrough'`

, and `'DisturbanceModel'`

name-value pair arguments to modify the default behavior of the *A*,
*B*, *C*, *D*, and
*K* matrices.

You can use this syntax with any of the previous input-argument com

## Examples

## Input Arguments

## Output Arguments

## References

[1] Ljung, L. *System
Identification: Theory for the User*, Appendix 4A, Second Edition, pp. 132–134.
Upper Saddle River, NJ: Prentice Hall PTR, 1999.

[2] van Overschee, P., and B. De Moor.
*Subspace Identification of Linear Systems: Theory, Implementation,
Applications.* Springer Publishing: 1996.

[3] Verhaegen, M. "Identification of
the deterministic part of MIMO state space models." *Automatica*, 1994,
Vol. 30, pp. 61–74.

[4] Larimore, W.E. "Canonical variate
analysis in identification, filtering and adaptive control." *Proceedings of the
29th IEEE Conference on Decision and Control*, 1990, pp. 596–604.

[5] McKelvey, T., H. Akcay, and L.
Ljung. "Subspace-based multivariable system identification from frequency response data."
*IEEE Transactions on Automatic Control*, 1996, Vol. 41, pp.
960–979.

## Version History

**Introduced before R2006a**