Sani Danjuma 17 46502u 2
Sani Danjuma 17 46502u 2
Sani Danjuma 17 46502u 2
SANI DANJUMA
17/46502U/2
SUBMITTED TO
THE DEPARTMENT OF MECHATRONICS ENGINEERING
FACULTY OF ENGINEERING AND ENGINEERING TECHNOLOGY
ABUBAKAR TAFAWA BALEWA UNIVERSITY, BAUCHI STATE
JULY, 2024
ABSTRACT:
This lab report details the creation and examination of state space models for various systems using
MATLAB. We developed state space models for linear time-invariant (LTI) systems and evaluated their
controllability and observability. The findings indicate that state space modeling is an effective approach for
comprehending and designing control systems. We effectively simulated and validated the behavior of the
systems, showcasing the efficacy of state space methods. This lab underscores the significance of state space
modeling and analysis in control systems engineering and emphasizes MATLAB's utility as a tool for
INTRODUCTION:
State space modeling of dynamic Linear Time-Invariant (LTI) systems enables control system designers to
utilize a wide range of tools from linear system theory for their design challenges. Besides MATLAB's
standard array of linear systems tools, the Control Systems Toolbox provides a variety of specialized state-
BACKGROUND
State space modeling is an effective approach for analyzing and designing control systems. It offers a
mathematical framework that represents complex systems through a set of first-order differential equations.
This framework facilitates the study of a system's behavior and the development of control strategies.In this
lab, we will use MATLAB to create state space models for various systems, analyze their behavior, and
transform systems into canonical forms. We will cover the following topics:
State space modeling of Linear Time-Invariant (LTI) systems
This hands-on experience will enhance your understanding of state space techniques and their
In this lab, we will use MATLAB to create state space models for various systems, analyze their behavior,
and transform systems into canonical forms. We will cover the following topics:
OBJECTIVES:
METHODOLOGY:
2. State Space Model Development: We developed state space models for each system using
MATLAB's `ss` function, representing the systems in the form of state equations (dx/dt = Ax + Bu, y
= Cx + Du).
3. Model Analysis: We analyzed the stability and controllability of each system using MATLAB's `eig`
5. Results and Discussion: We presented the results of our analysis and simulation, discussing the
EXERCISES:
QUESTION 1: SOLUTION
The system is converted into controllable canonical form as follows:
Let us choose the state variables as
̇
̈
Then we have the following set of equations
̇
̇
̇
̇
[ ̇ ] [ ][ ] [ ][ ]
̇
[ ][ ] [ ][ ]
Equation (vii) and (viii) constitutes the model of the system in controllable canonical form
QUESTION 2: SOLUTION
The transfer function was derived as follows:
Taking the Laplace transform of (i) and (ii) we have
From ix
[ ]
( )
MATLAB Script
1. Sys = tf([15 20 0 -5],[3 2 0 -1])
2. [A B C D] = ssdata(sys);
OUTPUT
A=
-0.6667 0 0.6667
1.0000 0 0
0 0.5000 0
B=
2
0
0
C=
1.6667 0 -0.0000
D=
5
Comments
The tf() created the transfer function of the system, using the derived transfer function from
equation (xii).
The transfer function can also be created by using the state model of the system in equation
(vii) and (viii) with ss() and tf() functions.
The ssdata() function converted the transfer function into state space representation as
shown on the output above.
MATLAB Script
1. A = [[0 1 0]; [0 0 1]; [1/3 0 -2/3]];
2. B = [0; 0; 2/3];
3. C = [0 0 5];
4. D = [5];
5. sys = ss(A, B, C, D);
6. P = ctrb(sys);
7. Ac = A*P*inv(P);
8. Bc = P*B;
9. Cc = C*inv(P);
10. Dc = D;
11. sys2 = ss(Ac, Bc, Cc, Dc);
12. [Abar, Bbar, Cbar, Dbar] = ssdata(sys2)
Output
Abar =
0 1.0000 0
0 0 1.0000
0.3333 0 -0.6667
Bbar =
0.4444
-0.2963
0.1975
Cbar =
7.5000 0 0
Dbar =
5
Comments
In this experiment, the state model of the system from equation (vii) and (viii) were used
with ss() function to create the state space representation of the system.
The system was transformed into controllable canonical form using transformation matrix
P and its inverse.
The output was successfully transformed into controllable canonical form with the same
values as calculated in equation (vii)
QUESTION 5: SOLUTION
Note that, the result from question (1) could be different from that of question (4). This ecause, when
MATLAB converts Transfer Function to State Space, it doesn't always pick the same states that we use to
generate the controllability in canonical form in question (1). Hence, it simply means a similarity
QUESTION 6: SOLUTION
MATLAB Script
1. A = [[0 1 0]; [0 0 1]; [1/3 0 -2/3]];
2. B = [0; 0; 2/3];
3. C = [0 0 5];
4. D = [5];
5. sys = ss(A, B, C, D);
6. sys2 = canon(sys, 'companion')
Output
sys2 =
A=
x1 x2 x3
x1 0 0 0.3333
x2 1 0 0
x3 0 1 -0.6667
B=
u1
x1 1
x2 0
x3 0
C=
x1 x2 x3
y1 3.333 -2.222 1.481
D=
u1
y1 5
Comments
The system was further transformed into observable canonical form by using ss() and
canon() function.
The output was successfully transformed into observable canonical form as shown above.
QUESTION 7: SOLUTION
Results:
MATLAB SCRIPT
OUTPUT
COMMENTS
This table indicates the eigen values and the eigen vectors of the matrix A. The eigen
values are determined using the eig() function and the corresponding result is shown in the
output above, where the eigen values appeared at the diagonal of the above matrix. The
eigen vectors was also displayed as shown in the output
QUESTION 8: SOLUTION
Note that, It is not necessary that the eigenvalues should be at the diagonal of matrix A. This is because
when using MATLAB, the eigenvalues of a matrix are not necessarily diagonal. The eig() function returns a
diagonal matrix containing the eigenvalues, but it also returns a matrix of eigenvectors that can be used to
QUESTION 9:
MATLAB Script
Output
Abar =
0.5282 0 0
0 -0.5974 0.5236
0 -0.5236 -0.5974
Bbar =
0.5455
-1.0492
1.0650
Cbar =
1.1061 -2.1096 0.4850
Dbar =
5
Comments
This table indicates the diagonalized form of the system using canon() function The system
was unable to be diagonalized using canon() function. This may be as a result of having
repeated eigenvalues as shown in table 4.
QUESTION 10: SOLUTION
Results:
MATLAB Script
Output
0.5282 - 0.0000i -0.0000 + 0.0000i -0.0000 - 0.0000i
-0.0000 - 0.0000i -0.5974 + 0.5236i -0.0000 + 0.0000i
-0.0000 + 0.0000i -0.0000 - 0.0000i -0.5974 - 0.5236i
Comments
This table indicates the diagonalized form of the system by forming diagonalization
matrix.
By forming diagonalization matrix, the system was diagonalized and it was observed that
the result is the same as diagonalization using eig() function in qustion 7.
CONCLUSION:
In this laboratory session, we successfully synthesized and scrutinized state-space models for
methodologies in the comprehension and design of control systems. Our empirical results
substantiate that state-space modeling is a robust framework for evaluating system stability
and controllability.
Moreover, we validated the utility of MATLAB as a computational tool for the implementation
dynamics. Our findings underscore the criticality of state-space modeling and analysis in
Furthermore, investigating alternative control paradigms, including optimal control and robust
control, could yield deeper insights into the potential and versatility of state-space modeling
and analysis.
References: