Main Content

canon

(Not recommended) Canonical state-space realization

canon is not recommended. Use modalreal and compreal instead. (since R2023b) For more information on how to update your code, see Version History.

Description

csys = canon(sys,type) transforms the linear model sys into the canonical realization csys. type specifies whether csys is in modal or companion form.

For information on controllable and observable canonical forms, see State-Space Realizations.

example

csys = canon(sys,'modal',condt) specifies an upper bound condt on the condition number of the block-diagonalizing transformation. Use condt if you have close lying eigenvalues in csys.

[csys,T]= canon(___) also returns the state-coordinate transformation matrix T that relates the states of the state-space model sys to the states of csys.

example

Examples

collapse all

Suppose you have a state-space model of an aircraft where the input is elevator deflection angle δ and the output is the aircraft pitch angle θ .

[ α ˙ q ˙ θ ˙ ] = [ - 0 . 3 1 3 5 6 . 7 0 - 0 . 0 1 3 9 - 0 . 4 2 6 0 0 5 6 . 7 0 ] [ α q θ ] + [ 0 . 2 3 2 0 . 0 2 0 3 0 ] [ δ ] y = [ 0 0 1 ] [ α q θ ] + [ 0 ] [ δ ]

Load the model data to the workspace and create the state-space model sys.

load('aircraftPitchSSModel.mat');
sys = ss(A,B,C,D)
sys =
 
  A = 
            x1       x2       x3
   x1   -0.313     56.7        0
   x2  -0.0139   -0.426        0
   x3        0     56.7        0
 
  B = 
           u1
   x1   0.232
   x2  0.0203
   x3       0
 
  C = 
       x1  x2  x3
   y1   0   0   1
 
  D = 
       u1
   y1   0
 
Continuous-time state-space model.

Convert the resultant state-space model sys to controllable companion form.

csys = canon(sys,'companion')
csys =
 
  A = 
              x1         x2         x3
   x1          0          0  1.914e-15
   x2          1          0    -0.9215
   x3          0          1     -0.739
 
  B = 
       u1
   x1   1
   x2   0
   x3   0
 
  C = 
            x1       x2       x3
   y1        0    1.151  -0.6732
 
  D = 
       u1
   y1   0
 
Continuous-time state-space model.

csys is the controllable companion form of sys.

Suppose you have a state-space model of an inverted pendulum on a cart where the outputs are the cart displacement x and the pendulum angle θ . The control input u is the horizontal force on the cart.

[ x ˙ x ¨ θ ˙ θ ¨ ] = [ 0 1 0 0 0 - 0 . 1 3 0 0 0 0 1 0 - 0 . 5 3 0 0 ] [ x x ˙ θ θ ˙ ] + [ 0 2 0 5 ] u y = [ 1 0 0 0 0 0 1 0 ] [ x x ˙ θ θ ˙ ] + [ 0 0 ] u

First, load the state-space model sys to the workspace.

load('pendulumCartSSModel.mat','sys');

Convert sys to modal form and extract the block sizes.

[csys,T] = canon(sys,'modal')
msys =
 
  A = 
           x1      x2      x3      x4
   x1       0       0       0       0
   x2       0   -0.05       0       0
   x3       0       0  -5.503       0
   x4       0       0       0   5.453
 
  B = 
          u1
   x1  1.875
   x2  6.298
   x3   12.8
   x4  12.05
 
  C = 
              x1         x2         x3         x4
   y1         16     -4.763  -0.003696   0.003652
   y2          0   0.003969   -0.03663    0.03685
 
  D = 
       u1
   y1   0
   y2   0
 
Continuous-time state-space model.
T = 4×4

    0.0625    1.2500   -0.0000   -0.1250
         0    4.1986    0.0210   -0.4199
         0    0.2285  -13.5873    2.4693
         0   -0.2251   13.6287    2.4995

csys is the modal canonical form of sys, while T represents the transformation between the state vectors of sys and csys.

Input Arguments

collapse all

Dynamic system, specified as a SISO, or MIMO dynamic system model. Dynamic systems that you can use include:

  • Continuous-time or discrete-time numeric LTI models, such as tf (Control System Toolbox), zpk (Control System Toolbox), ss (Control System Toolbox), or pid (Control System Toolbox) models.

  • Generalized or uncertain LTI models such as genss (Control System Toolbox) or uss (Robust Control Toolbox) models. (Using uncertain models requires Robust Control Toolbox™ software.)

    The resulting canonical state-space model assumes

    • current values of the tunable components for tunable control design blocks.

    • nominal model values for uncertain control design blocks.

  • Identified LTI models, such as idtf, idss, idproc, idpoly, and idgrey models.

You cannot use frequency-response data models such as frd (Control System Toolbox) models.

Transformation type, specified as either 'modal' or 'companion'. If type is unspecified, then canon converts the specified dynamic system model to modal canonical form by default.

The companion canonical form is the same as the observable canonical form. For information on controllable and observable canonical forms, see State-Space Realizations.

  • Modal Form

    In modal form, A is a block-diagonal matrix. The block size is typically 1-by-1 for real eigenvalues and 2-by-2 for complex eigenvalues. However, if there are repeated eigenvalues or clusters of nearby eigenvalues, the block size can be larger.

    For example, for a system with eigenvalues (λ1,σ±jω,λ2), the modal A matrix is of the form

    Am=[λ10000σω00ωσ0000λ2].

  • Companion Form

    In the companion realization, the characteristic polynomial of the system appears explicitly in the rightmost column of the A matrix. For a system with characteristic polynomial

    P(s)=sn+αn1sn1+αn2sn2++α1s+α0,

    the corresponding companion A matrix is

    Accom=[01000001000001000001α0α1α2α3  αn1],Bccom=[100].

    The companion transformation requires that the system is controllable from the first input. The transformation to companion form is based on the controllability matrix which is almost always numerically singular for mid-range orders. Hence, avoid using it when possible.

    The companion realization returned by canon is sometimes known as controllable canonical form. For more information on observable and controllable canonical forms, see State-Space Realizations.

Upper bound on the condition number of the block-diagonalizing transformation, specified as a positive scalar. This argument is available only when type is set to 'modal'.

Increase condt to reduce the size of the eigenvalue clusters in the A matrix of csys. Setting condt = Inf diagonalizes matrix A.

Output Arguments

collapse all

Canonical state-space form of the dynamic model, returned as an ss (Control System Toolbox) model object. csys is a state-space realization of sys in the canonical form specified by type.

Transformation matrix, returned as an n-by-n matrix, where n is the number of states. T is the transformation between the state vector x of the state-space model sys and the state vector xc of csys:

xc = Tx

.

This argument is available only when sys is an ss (Control System Toolbox) model object.

Limitations

  • You cannot use frequency-response data models to convert to canonical state-space form.

  • The companion form is poorly conditioned for most state-space computations, that is, the transformation to companion form is based on the controllability matrix which is almost always numerically singular for mid-range orders. Hence, avoid using it when possible.

Algorithms

The canon command uses the bdschur (Control System Toolbox) command to convert sys into modal form and to compute the transformation T. If sys is not a state-space model, canon first converts it to state space using ss.

The reduction to companion form uses a state similarity transformation based on the controllability matrix [1].

References

[1] Kailath, T. Linear Systems, Prentice-Hall, 1980.

Version History

Introduced before R2006a

expand all

R2023b: Not recommended

The canon command is not recommended. Use the functionality described in this table instead.

RealizationOld CommandNew Command
Modal

sysT = canon(sys,'modal')

sysT = modalreal(sys)

Companion

sysT = canon(sys,'companion')

sysT = compreal(sys)

For more information about the new commands, see modalreal (Control System Toolbox) and compreal (Control System Toolbox).

See Also

(Control System Toolbox) | (Control System Toolbox) | (Control System Toolbox) | (Control System Toolbox) | (Control System Toolbox) | (Control System Toolbox) | (Control System Toolbox) | (Control System Toolbox) | (Robust Control Toolbox) | | | | |