Documentation Center 
Statespace canonical realization
csys = canon(sys,type)
[csys,T]=
canon(sys,type)
csys = canon(sys,'modal',condt)
csys = canon(sys,type) transforms the linear model sys into a canonical statespace model csys. The argument type specifies whether csys is in modal or companion form.
[csys,T]= canon(sys,type) also returns the statecoordinate transformation T that relates the states of the statespace model sys to the states of csys.
csys = canon(sys,'modal',condt) specifies an upper bound condt on the condition number of the blockdiagonalizing transformation.
sys 
Any linear dynamic system model, except for frd models. 
type 
String specifying the type of canonical form of csys. type can take one of the two following values:

condt 
Positive scalar value specifying an upper bound on the condition number of the blockdiagonalizing transformation that converts sys to csys. This argument is available only when type is 'modal'. Increase condt to reduce the size of the eigenvalue clusters in the A matrix of csys. Setting condt = Inf diagonalizes A. Default: 1e8 
csys 
Statespace (ss) model. csys is a statespace realization of sys in the canonical form specified by type. 
T 
Matrix specifying the transformation between the state vector x of the statespace model sys and the state vector x_{c} of csys: x_{c} = Tx . This argument is available only when sys is statespace model. 
This example uses canon to convert a system having doubled poles and clusters of close poles to modal canonical form.
Consider the system G having the following transfer function:
To create a linear model of this system and convert it to modal canonical form, enter:
G = zpk([1 1],[0 10 10.0001 1+1i 11i 1+1i 11i],100); Gc = canon(G,'modal');
The system G has a pair of nearby poles at s = –10 and s = –10.0001. G also has two complex poles of multiplicity 2 at s = 1 + i and s = 1 – i. As a result, the modal form, has a block of size 2 for the two poles near s = –10, and a block of size 4 for the complex eigenvalues. To see this, enter the following command:
Gc.A
ans = 0 0 0 0 0 0 0 0 1.0000 1.0000 0 0 0 0 0 1.0000 1.0000 2.0548 0 0 0 0 0 0 1.0000 1.0000 0 0 0 0 0 1.0000 1.0000 0 0 0 0 0 0 0 10.0000 8.0573 0 0 0 0 0 0 10.0001
To separate the two poles near s = –10, you can increase the value of condt. For example:
Gc2 = canon(G,'modal',1e10); Gc2.A
ans = 0 0 0 0 0 0 0 0 1.0000 1.0000 0 0 0 0 0 1.0000 1.0000 2.0548 0 0 0 0 0 0 1.0000 1.0000 0 0 0 0 0 1.0000 1.0000 0 0 0 0 0 0 0 10.0000 0 0 0 0 0 0 0 10.0001
The A matrix of Gc2 includes separate diagonal elements for the poles near s = –10. The cost of increasing the maximum condition number of A is that the B matrix includes some large values.
format shortE Gc2.B ans = 3.2000e001 6.5691e003 5.4046e002 1.9502e001 1.0637e+000 3.2533e+005 3.2533e+005
This example estimates a statespace model that is freely parameterized and convert to companion form after estimation.
load icEngine.mat z = iddata(y,u,0.04); FreeModel = n4sid(z,4,'InputDelay',2); CanonicalModel = canon(FreeModel, 'companion')
Obtain the covariance of the resulting form by running a zeroiteration update to model parameters.
opt = ssestOptions; opt.SearchOption.MaxIter = 0; CanonicalModel = ssest(z, CanonicalModel, opt)
Compare frequency response confidence bounds of FreeModel to CanonicalModel.
h = bodeplot(FreeModel, CanonicalModel)
the bounds are identical.