Main Content

obsv

Observability of state-space model

    Description

    A dynamic system is said to be observable if all its states can be known from the output of the system. obsv computes an observability matrix from state matrices or from a state-space model. You can use this matrix to determine observability.

    For instance, consider a continuous-time state-space model with Nx states, Ny outputs, and Nu inputs:

    x˙=Ax+Buy=Cx+Du

    Here, x, u and y represent the states, inputs and outputs respectively, while A, B, C and D are the state-space matrices with the following sizes:

    • A is an Nx-by-Nx real-valued or complex-valued matrix.

    • B is an Nx-by-Nu real-valued or complex-valued matrix.

    • C is an Ny-by-Nx real-valued or complex-valued matrix.

    • D is an Ny-by-Nu real-valued or complex-valued matrix.

    The system is observable if the observability matrix generated by obsv Ob=[CCACA2  :CAn1] has full rank, that is, the rank is equal to the number of states in the state-space model. The observability matrix Ob has Nx rows and Nxy columns. For an example, see Observability of SISO State-Space Model.

    Ob = obsv(A,C) returns the observability matrix Ob using the state matrix A and state-to-output matrix C. The system is observable if Ob has full rank, that is, the rank of Ob is equal to the number of states.

    example

    Ob = obsv(sys) returns the observability matrix of the state space model sys. This syntax is equivalent to:

    Ob = obsv(sys.A,sys.C);

    example

    Examples

    collapse all

    Define A and C matrices.

    A = [1  1;
         4 -2];
    C = [-1 1;
         1 -1];

    Compute observability matrix.

    Ob = obsv(A,C);

    Determine the number of unobservable states.

    unobsv = length(A) - rank(Ob)
    unobsv = 
    1
    

    The unobservable state indicates that Ob does not have full rank 2. Therefore, the system is not observable.

    For this example, consider the following SISO state-space model with 2 states:

    A=[-1.5-210]B=[0.50]C=[01]D=1SISO State-Space Model

    Create the SISO state-space model defined by the following state-space matrices:

    A = [-1.5,-2;1,0];
    B = [0.5;0];
    C = [0,1];
    D = 1;
    sys = ss(A,B,C,D);

    Compute the observability matrix and find the rank.

    Ob = obsv(sys)
    Ob = 2×2
    
         0     1
         1     0
    
    

    The size of the observability matrix depends on the size of the A and C matrices. For instance, if matrix A is an Nx-by-Nx matrix and matrix C is an Nx-by-Ny matrix, then the resultant matrix Ob has Nx rows and Nxy columns. Here, Nx is the number of states and Ny is the number of outputs.

    rank(Ob)
    ans = 
    2
    

    Since the rank of the observability matrix Ob is equal to the number of states, the system sys is observable.

    Alternatively, you can also use just the A and C matrices to find the observability matrix.

    Ob = obsv(sys.A,sys.C);
    rank(Ob)
    ans = 
    2
    

    Input Arguments

    collapse all

    State matrix, specified as an Nx-by-Nx matrix where, Nx is the number of states.

    State-to-output matrix, specified as an Ny-by-Nx matrix where, Nx is the number of states and Ny is the number of outputs.

    State-space model or model array, specified as:

    • A state-space (ss) model object, when the inputs A, B, C and D are numeric matrices or when converting from another model object type.

    • A generalized state-space model (genss) object, when one or more of the matrices A, B, C and D includes tunable parameters, such as realp parameters or generalized matrices (genmat). The function uses the current values for tunable parameters.

    • An uncertain state-space model (uss) object, when one or more of the inputs A, B, C and D includes uncertain matrices. The function uses the nominal values for uncertain parameters. Using uncertain models requires Robust Control Toolbox™ software.

    Output Arguments

    collapse all

    Observability matrix, returned as an array. When sys is:

    • A single state-space model with Nx states and Ny outputs, then the resultant array Ob has Nx rows and Nxy columns.

    • An array of state-space models sys(:,:,j1,...,jN), then Ob is an array with N+2 dimensions, that is, Ob(:,:,j1,...,jN).

    Limitations

    • obsv is not recommended for control design as computing the rank of the observability matrix is not recommended for observability testing. Ob will be numerically singular for most systems with more than a handful of states. This fact is well-documented under section III in [1].

    References

    [1] Paige, C. C. "Properties of Numerical Algorithms Related to Computing Controllability." IEEE Transactions on Automatic Control. Vol. 26, Number 1, 1981, pp. 130-138.

    Version History

    Introduced before R2006a