Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

ABUBAKAR TAFAWA BALEWA UNIVESITY

P.M.B 0248 BAUCHI NIGERIA

MECHATRONICS (MTE520) LAB REPORT


ON

STATE SPACE MODELLING AND ANALYSIS


BY

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

implementing these techniques.

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-

space design and analysis tools.

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

 Analysis of system observability and controllability

 Simulation and verification of specific functions

 This hands-on experience will enhance your understanding of state space techniques and their

applications in control system design

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:

 Understand the basics of state space modeling and analysis

 Learn how to develop state space models using MATLAB

 Model creation using ss(), ssdata(), rss()

 State transformation using ss2ss(), canon()

 Formation of controllability and observability matrices using ctrb(), obsv()

 State space/transfer function conversion

 Verify and validate system behaviour through simulation and analysis

METHODOLOGY:

1. System Identification: The systems to be modelled were identified

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`

and `rank` functions, respectively.


4. Simulation and Verification: We simulated the behaviour of each system using MATLAB functions,

comparing the result with analytical method.

5. Results and Discussion: We presented the results of our analysis and simulation, discussing the

implications of our findings and the effectiveness of state space techniques.

EXERCISES:

Given the differential equation


⃛ ̈
̈

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
̇
̇
̇

On representing (iii), (iv), (v) and (vi) in matrix form

̇
[ ̇ ] [ ][ ] [ ][ ]
̇

[ ][ ] [ ][ ]

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
[ ]

Substituting xi into x, we have

( )

Equation (xii) is the transfer function of the system.


QUESTION 3: SOLUTION

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.

The generated state space representation is not in controllable canonical form.


QUESTION 4: 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. 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

transformation is needed to convert between the two systems.

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

1. A = [[0 1 0]; [0 0 1]; [1/3 0 -2/3]];


2. [V,D] = eig(A);
3. disp(D); %eigen value
4. disp(V); %eigen vector

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

-0.8585 + 0.0000i 0.7020 + 0.0000i 0.7020 + 0.0000i


-0.4534 + 0.0000i -0.4194 + 0.3676i -0.4194 - 0.3676i
-0.2395 + 0.0000i 0.0581 - 0.4392i 0.0581 + 0.4392i

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

transform the original matrix into a diagonal matrix.

QUESTION 9:

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. [diagonalsys, L] = canon(sys, 'modal');
7. [Abar Bbar Cbar Dbar] = ssdata(diagonalysis)

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

1. A = [[0 1 0]; [0 0 1]; [1/3 0 -2/3]];


2. B = [0; 0; 5];
3. C = [0 0 5];
4. D = [5];
5. sys = ss(A, B, C, D);
6. [T,D] = eig(A);
7. diagonalsys = ss2ss(sys, inv(T));
8. disp(diagonalsys.A);

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

various dynamical systems using MATLAB. We illustrated the efficacy of state-space

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

of state-space techniques, facilitating the seamless simulation and verification of system

dynamics. Our findings underscore the criticality of state-space modeling and analysis in

control systems engineering and demonstrate the extensive applicability of state-space

methods across diverse domains.

Prospective research could entail the application of state-space methodologies to more

intricate systems, such as nonlinear systems or multi-input multi-output (MIMO) systems.

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:

 MTE520 (MECHATRONICS ENGINEERING LABORATORY VI) Manual

You might also like