Software Oriented

State Space Analysis for Controllability and Observability using MATLAB

Aim

The aim of this experiment is to analyze the controllabilitycontrollabilityA property of a system indicating whether it is possible to transfer the system from any initial state to any desired final state in a finite time using unconstrained control inputs. and observabilityobservabilityA property of a system indicating whether its internal states can be completely determined by observing its outputs over a finite time interval. of given linear time-invariant systems using state space representationstate space representationA mathematical model of a physical system as a set of input, output and state variables related by first-order differential equations, primarily used for modern control theory. and MATLAB.

Apparatus & Software

Sl. No.Apparatus / SoftwareTechnical SpecificationQuantities
1MATLABR2023 or compatible version with Control System Toolbox1
2SimulinkIntegrated with MATLAB for block diagram simulation1

Theory

State space analysis is a powerful mathematical approach used for modeling and analyzing dynamic systems, especially in modern control engineering. Unlike classical control methods which mainly focus on input–output relationships, state space analysis considers the internal behavior of the system through state variables.
State Space Representation
In state space analysis, a linear time-invariant (LTI) system is represented using a set of first-order differential equations. These equations describe how the system states change over time and also relate them to the system input and output. The general state space model of an LTI system is given by:
x˙(t)=Ax(t)+Bu(t)\dot{x}(t) = Ax(t) + Bu(t)
y(t)=Cx(t)+Du(t)y(t) = Cx(t) + Du(t)
where x(t) is the state vector representing the internal state of the system, u(t) is the input or control signal, y(t) is the output of the system, A is the system matrix, B is the input matrix, C is the output matrix, and D is the feedforward matrix. The order of the system is determined by the number of state variables. State space representation is widely used because it can handle multi-input multi-output (MIMO) systems and provides a complete description of the system dynamics.
Controllability
Controllability is an important property of a dynamic system. A system is said to be controllable if it is possible to move the system from any initial state to any desired final state within a finite time using an appropriate control input. For an LTI system, controllability can be tested using the controllability matrix, which is defined as:
C=[BABA2BAn1B]\mathcal{C} = \begin{bmatrix} B & AB & A^2B & \cdots & A^{n-1}B \end{bmatrix}
where n is the order of the system. The system is said to be completely controllable if the rank of the controllability matrix is equal to n:
rank(C)=n\text{rank}(\mathcal{C}) = n
Observability
Observability refers to the ability to determine the internal states of a system by observing its external output over time. A system is said to be observable if the complete state vector can be uniquely determined from the output measurements. The observability matrix of an LTI system is given by:
O=[CCACA2CAn1]\mathcal{O} = \begin{bmatrix} C \\ CA \\ CA^2 \\ \vdots \\ CA^{n-1} \end{bmatrix}
The system is completely observable if the rank of the observability matrix is equal to the order of the system:
rank(O)=n\text{rank}(\mathcal{O}) = n

Pre-Lab / Circuit Diagram (Not Applicable)

This section is not required for this experiment.

Procedure

The following steps are followed to analyze the controllability and observability of the given systems:
  1. Write the state space equations of the given system.
  2. Form the state matrices A, B, C, and D.
  3. Create the state space model of the system using MATLAB.
  4. Determine the controllability matrix and calculate its rank.
  5. Determine the observability matrix and calculate its rank.
  6. Verify whether the system is controllable and observable based on the rank conditions.
Following the above procedure, the following systems are analyzed:
  1. System 1: d²y/dt² + 3(dy/dt) + 2y = u
  2. System 2: d³y/dt³ + 6(d²y/dt²) + 11(dy/dt) + 6y = u
  3. System 3: d²y/dt² + 3(dy/dt) + 2y = u (with different output equation)
  4. System 4: d³y/dt³ − 6(d²y/dt²) + 11(dy/dt) − 6y = 2(du/dt) − 2u
For all the given systems, the state space equations are obtained by suitably defining the state variables. Based on these equations, the state matrices A, B, C, and D are derived. Using the derived matrices, the state space model is implemented in MATLAB using the ss(A,B,C,D) function. The controllability and observability matrices are then obtained, and their ranks are calculated using the rank() function.

Simulation / Execution

Figure 1: MATLAB code for state space model, controllability, and observability analysis

Figure 1: MATLAB code for state space model, controllability, and observability analysis

System 2 was additionally realized using Simulink to study its dynamic behavior. The state space model of the system was implemented using appropriate Simulink blocks.
Figure 3: Simulink block diagram for System 2

Figure 3: Simulink block diagram for System 2

Figure 4: Simulink output response for System 2

Figure 4: Simulink output response for System 2

Observations

The MATLAB outputs showing controllability and observability results for the systems are captured below.
Output response for System 1

Figure: MATLAB output showing controllability and observability results for System 1

Output response for System 2

Figure: MATLAB output showing controllability and observability results for System 2

Output response for System 3

Figure: MATLAB output showing controllability and observability results for System 3

Output response for System 4

Figure: MATLAB output showing controllability and observability results for System 4

System 1 — MATLAB Output:
MatrixValuesRank
Controllability Matrix[[0, 1], [1, -3]]2
Observability Matrix[[1, 0], [0, 1]]2
System 2 — MATLAB Output:
MatrixValuesRank
Controllability Matrix[[0, 0, 1], [0, 1, -6], [1, -6, 25]]3
Observability Matrix[[1, 0, 0], [0, 1, 0], [0, 0, 1]]3
System 3 — MATLAB Output:
MatrixValuesRank
Controllability Matrix[[0, 0], [1, -2]]1
Observability Matrix[[1, 1], [-1, -2]]2
System 4 — MATLAB Output:
MatrixValuesRank
Controllability Matrix[[0, 0, 0], [1, 2, 4], [1, 3, 9]]2
Observability Matrix[[1, 1, 1], [1, 2, 3], [1, 4, 9]]3

Calculations

System 1
Given differential equation:
d2ydt2+3dydt+2y=u\frac{d^2y}{dt^2} + 3\frac{dy}{dt} + 2y = u
Define state variables: x₁ = y, x₂ = dy/dt. State equations:
x˙1=x2,x˙2=2x13x2+u\dot{x}_1 = x_2, \quad \dot{x}_2 = -2x_1 - 3x_2 + u
Output equation: y = x₁. State matrices:
A=[0123],  B=[01],  C=[10],  D=[0]A = \begin{bmatrix} 0 & 1 \\ -2 & -3 \end{bmatrix},\; B = \begin{bmatrix} 0 \\ 1 \end{bmatrix},\; C = \begin{bmatrix} 1 & 0 \end{bmatrix},\; D = [0]
System 2
Given differential equation:
d3ydt3+6d2ydt2+11dydt+6y=u\frac{d^3y}{dt^3} + 6\frac{d^2y}{dt^2} + 11\frac{dy}{dt} + 6y = u
Define state variables: x₁ = y, x₂ = dy/dt, x₃ = d²y/dt². State equations:
x˙1=x2,x˙2=x3,x˙3=6x111x26x3+u\dot{x}_1 = x_2, \quad \dot{x}_2 = x_3, \quad \dot{x}_3 = -6x_1 - 11x_2 - 6x_3 + u
Output equation: y = x₁. State matrices:
A=[0100016116],  B=[001],  C=[100],  D=[0]A = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ -6 & -11 & -6 \end{bmatrix},\; B = \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix},\; C = \begin{bmatrix} 1 & 0 & 0 \end{bmatrix},\; D = [0]
System 3
Given differential equation:
d2ydt2+3dydt+2y=u\frac{d^2y}{dt^2} + 3\frac{dy}{dt} + 2y = u
Define state variables: x₁ = y, x₂ = dy/dt. State equations:
x˙1=x2,x˙2=2x13x2+u\dot{x}_1 = x_2, \quad \dot{x}_2 = -2x_1 - 3x_2 + u
Output equation: y = x₁ + x₂. State matrices:
A=[0123],  B=[01],  C=[11],  D=[0]A = \begin{bmatrix} 0 & 1 \\ -2 & -3 \end{bmatrix},\; B = \begin{bmatrix} 0 \\ 1 \end{bmatrix},\; C = \begin{bmatrix} 1 & 1 \end{bmatrix},\; D = [0]
System 4
Given differential equation:
d3ydt36d2ydt2+11dydt6y=2dudt2u\frac{d^3y}{dt^3} - 6\frac{d^2y}{dt^2} + 11\frac{dy}{dt} - 6y = 2\frac{du}{dt} - 2u
State equations chosen as:
x˙1=x1,x˙2=2x2+u,x˙3=3x3+u\dot{x}_1 = x_1, \quad \dot{x}_2 = 2x_2 + u, \quad \dot{x}_3 = 3x_3 + u
Output equation: y = x₁ + x₂ + x₃. State matrices:
A=[100020003],  B=[011],  C=[111],  D=[0]A = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{bmatrix},\; B = \begin{bmatrix} 0 \\ 1 \\ 1 \end{bmatrix},\; C = \begin{bmatrix} 1 & 1 & 1 \end{bmatrix},\; D = [0]

Results & Analysis

The controllability and observability of each system are determined by comparing the rank of the respective matrices with the order of the system. The results are summarized below.
SystemOrder (n)Rank of Controllability MatrixControllable?Rank of Observability MatrixObservable?
System 122Yes2Yes
System 233Yes3Yes
System 321No2Yes
System 432No3Yes
System 1: The order of the system is 2. The rank of the controllability matrix is 2 (equal to n), hence the system is completely controllable. The rank of the observability matrix is also 2, indicating the system is completely observable.
System 2: The order of the system is 3. The rank of the controllability matrix is 3 (equal to n), therefore the system is completely controllable. The rank of the observability matrix is also 3, showing the system is completely observable.
System 3: The order of the system is 2. The rank of the controllability matrix is 1 (not equal to n), hence the system is uncontrollable. The rank of the observability matrix is 2, confirming the system is observable.
System 4: The order of the system is 3. The rank of the controllability matrix is 2 (not equal to n), thus the system is uncontrollable. The rank of the observability matrix is 3, indicating the system is completely observable.
Additionally, System 2 was realized using Simulink. The Simulink results were found to be consistent with the theoretical and MATLAB-based analysis.

Conclusion

In this experiment, the controllability and observability of different linear time-invariant systems were analyzed using the state space approach. The given higher-order differential equations were first converted into state space form by selecting appropriate state variables. Based on this representation, the state matrices A, B, C, and D were derived for each system.
Using MATLAB, the state space models were implemented and the controllability and observability matrices were obtained. The rank of these matrices was compared with the order of the respective systems to verify the controllability and observability conditions. From the analysis, it was observed that the systems for which the rank of the matrices was equal to the system order were completely controllable and observable.
Additionally, one of the systems (System 2) was realized using Simulink to study its dynamic behavior. The Simulink results were found to be consistent with the theoretical and MATLAB-based analysis. This experiment highlights the importance of state space analysis in understanding system behavior and in the design of effective control systems.

Post-Lab / Viva Voce

Note: The following questions are intended to evaluate conceptual understanding arising from this experiment on State Space Analysis for Controllability and Observability.
  1. Q: What is state space representation and why is it preferred over classical transfer function methods for MIMO systems?

    A: State space representation uses a set of first-order differential equations of the form ẋ(t) = Ax(t) + Bu(t) and y(t) = Cx(t) + Du(t) to describe a system's internal dynamics. Unlike transfer functions, which only capture input-output relationships, state space models expose the internal state variables of the system. This makes them directly applicable to multi-input multi-output (MIMO) systems, time-varying systems, and nonlinear systems, and they allow analysis of properties such as controllability and observability that are not visible from the transfer function alone.
  2. Q: Define controllability. What does it physically mean if a system is uncontrollable?

    A: A system is said to be completely controllable if there exists a finite-time control input u(t) that can drive the system from any arbitrary initial state x(0) to any desired final state x(T). Physically, if a system is uncontrollable, it means that certain state variables cannot be influenced by the applied input, regardless of how the input is designed. For example, in System 3 of this experiment, the rank of the controllability matrix was 1 (less than the system order n = 2), meaning at least one state mode is decoupled from the input and cannot be steered.
  3. Q: Define observability. What is the practical consequence of a system being unobservable?

    A: A system is completely observable if the complete state vector x(t) can be uniquely determined from the output measurements y(t) over a finite time interval, regardless of the input. Practically, if a system is unobservable, it means certain internal states produce no effect on the measured output. This is a serious problem in control design because state feedback controllers and state estimators (such as Luenberger observers or Kalman filters) require full knowledge of system states. An unobservable state cannot be estimated from output measurements and therefore cannot be controlled through output feedback.
  4. Q: How is the rank of the controllability matrix used to determine whether a system is controllable? What happens when the rank is deficient?

    A: For an nth-order LTI system, the controllability matrix is C = [B, AB, A²B, …, A^(n−1)B]. The system is completely controllable if and only if rank(C) = n. If rank(C) < n, the matrix is rank-deficient, meaning its columns are linearly dependent. This indicates that the reachable subspace spanned by the controllability matrix has dimension less than n, so not all states can be independently excited by the input. In this experiment, System 3 had rank(C) = 1 < 2, confirming it is uncontrollable.
  5. Q: Systems 1 and 3 in this experiment have identical A and B matrices but different C matrices. How does changing only the C matrix affect controllability and observability?

    A: The controllability matrix C = [B, AB, A²B, …] depends only on A and B, not on C. Therefore, changing the output matrix C has no effect on controllability — both System 1 and System 3 have the same controllability matrix and rank. However, the observability matrix O = [C; CA; CA²; …] depends directly on C. In System 1, C = [1 0], giving rank(O) = 2 (fully observable). In System 3, C = [1 1], which also gives rank(O) = 2 (still observable), but the output now combines both state variables, affecting how states appear in the output signal.
  6. Q: In System 4, the controllability matrix has rank 2 but the system order is 3. Why is the system uncontrollable despite having a non-zero controllability matrix?

    A: A non-zero controllability matrix does not guarantee controllability — the critical condition is that rank(C) must equal the system order n. For System 4, the state matrix A is diagonal with entries {1, 2, 3} and B = [0; 1; 1]. The first row of B is zero, meaning the first state x₁ receives no direct input. Furthermore, x₁ evolves as ẋ₁ = x₁, an unstable autonomous mode that is entirely decoupled from the input. Since u(t) cannot influence x₁ through any combination of input channels, the system is uncontrollable and the controllability matrix rank is 2, not 3.
  7. Q: What is the significance of the MATLAB functions ctrb(), obsv(), and rank() in this experiment?

    A: The ctrb(A, B) function constructs the controllability matrix C = [B, AB, …, A^(n−1)B] directly from the system matrices. The obsv(A, C) function constructs the observability matrix O = [C; CA; …; CA^(n−1)]. The rank() function then computes the numerical rank of these matrices using singular value decomposition. Comparing the computed rank against the system order n provides a definitive, numerically reliable test for controllability and observability without manually computing matrix determinants, which can be numerically ill-conditioned for higher-order systems.
  8. Q: Can a system be controllable but not observable, or observable but not controllable? Give an example from this experiment.

    A: Yes, controllability and observability are independent properties. A system can satisfy one condition without satisfying the other. System 3 in this experiment is a clear example: its controllability matrix has rank 1 (uncontrollable) but its observability matrix has rank 2 (completely observable). Similarly, a system could be controllable but not observable if all state modes are reachable by the input but some modes produce no measurable output. This independence is captured by the Kalman decomposition, which separates system dynamics into four subspaces: controllable-observable, controllable-unobservable, uncontrollable-observable, and uncontrollable-unobservable.

References & Resources (Not Applicable)

This section is not required for this experiment.