0% found this document useful (0 votes)
20 views

Matlab 3

Uploaded by

Karumon Utsumi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Matlab 3

Uploaded by

Karumon Utsumi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Mindanao State University

MSU-Main, Marawi City


Department of Electrical Engineering

EEE 160 LABORATORY


EXPERIMENT NO.3

Submitted to:
Engr. Johaimen M. Omar

Submitted by:
Rauda Nano Antol

May 12, 2023


EEE 160 LABORATORY EXPERIMENT NO. 3
1.1 OBJECTIVES
To learn to use MATLAB to (1) generate an LTI state-space representation of a system and (2) convert an LTI
state-space representation of a system to an LTI transfer function.

1.2 MINIMUM REQUIRED SOFTWARE PACKAGES


MATLAB

1.3 PRELAB
1. Derive the state-space representation of the translational mechanical system shown in Fig. 3.1. Consider
the output to be 𝑥3 (𝑡).

Figure 3.1
Solution 1:
Place on the mass all forces felt by the mass as shown on the free-body diagram.
For the transformed motion of the first mass (starting to the left), 𝑋1 (𝑠)
2 𝑋1 (𝑠)
𝑠 𝑋1 (𝑠) + 𝑠𝑋1 (𝑠) + 𝑋1 (𝑠) − 𝑠𝑋2 (𝑠) = 𝐹 (𝑠)
𝑠𝑋1 (𝑠)
(𝑠2 + 𝑠 + 1)𝑋1 (𝑠) − 𝑠𝑋2 (𝑠) = 𝐹 (𝑠) 𝑠2 𝑋1 (𝑠)
𝑠𝑋2 (𝑠)
𝐹 (𝑠)

Of the second mass,


𝑋2 (𝑠)
−𝑠𝑋1 (𝑠) + 𝑠2 𝑋2 (𝑠) + 𝑠𝑋2 (𝑠) + 𝑋2 (𝑠) − 𝑋3 (𝑠) = 0 𝑠𝑋2 (𝑠)
−𝑠𝑋1 (𝑠) + (𝑠2 + 𝑠 + 1)𝑋2 (𝑠) − 𝑋3 (𝑠) = 0 𝑋2 (𝑠)
𝑠𝑋1 (𝑠)
𝑋3 (𝑠)
𝑠2 𝑋2 (𝑠)
Of the third mass, 𝑋3 (𝑠)
−𝑋2 (𝑠) + 𝑠2 𝑋3 (𝑠) + 𝑠𝑋3 (𝑠) + 𝑋3 (𝑠) = 0 𝑋3 (𝑠)
−𝑋2 (𝑠) + (𝑠2 + 𝑠 + 1)𝑋3 (𝑠) = 0 𝑋2 (𝑠) 𝑠𝑋3 (𝑠)
2
𝑠 𝑋3 (𝑠)

For this transformed system of equations above, zero initial conditions are assumed.
Aside from denoting the Laplace transform, a dot notation as differentiation with respect to time can be
represented.
𝑥̈1 + 𝑥̇1 + 𝑥1 − 𝑥̇2 = 𝑓
−𝑥̇1 + 𝑥̈2 + 𝑥̇2 + 𝑥2 − 𝑥3 = 0
−𝑥2 + 𝑥̈3 + 𝑥̇3 + 𝑥3 = 0
The state-space representation of a system is given by
𝐳̇ = 𝐀𝐳 + 𝐁𝑓 (𝑡)
𝐲 = 𝐂𝐳 + 𝐃𝑓 (𝑡)
To assign state variables and its derivative with respect to time, we have
𝑧1 = 𝑥 1 𝑧̇1 = 𝑥̇1 = 𝑧2
𝑧2 = 𝑥̇1 𝑧̇2 = 𝑥̈1
𝑧3 = 𝑥 2 𝑧̇3 = 𝑥̇2 = 𝑧4
𝑧4 = 𝑥̇2 𝑧̇4 = 𝑥̈2
𝑧5 = 𝑥 3 𝑧̇5 = 𝑥̇3 = 𝑧6
𝑧6 = 𝑥̇3 𝑧̇6 = 𝑥̈3
Substituting these quantities to the system of equations become
𝑧̇2 + 𝑧2 + 𝑧1 − 𝑧4 = 𝑓
−𝑧2 + 𝑧̇4 + 𝑧4 + 𝑧3 − 𝑧5 = 0
−𝑧3 + 𝑧̇6 + 𝑧6 + 𝑧5 = 0
To form the system matrix A and input matrix B, completing that the state equations are
𝑧̇1 = 𝑧2
𝑧̇2 = −𝑧1 − 𝑧2 − 𝑧4 + 𝑓
𝑧̇3 = 𝑧4
𝑧̇4 = 𝑧2 − 𝑧3 − 𝑧4 + 𝑧5
𝑧̇5 = 𝑧6
𝑧̇6 = 𝑧3 − 𝑧5 − 𝑧6
For the output matrix C, recalling that 𝑥3 = 𝑧5. For the feedthrough matrix D, there is no given.
In vector-matrix form,

⎡𝑧̇1 0⎤ ⎡ 0 1 0 0 0 0 ⎤ ⎡𝑥1 0⎤ ⎡ 00⎤


⎢𝑧̇ 0⎥ ⎢ –1 –1 0 1 0 0 ⎥⎥ ⎢⎢𝑥̇1 0⎥⎥ ⎢⎢ 10⎥⎥
⎢ 2⎥ ⎢
⎢𝑧̇3 0⎥ ⎢ 0 0 0 1 0 0 ⎥ ⎢𝑥2 0⎥ ⎢ 00⎥
⎢ ⎥=⎢ ⎥ ⎢ ⎥ + ⎢ ⎥ 𝑓 (𝑡)
⎢𝑧̇4 0⎥ ⎢ 0 1 –1 –1 1 0 ⎥ ⎢𝑥̇2 0⎥ ⎢ 00⎥
⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢𝑧̇5 0⎥ ⎢ 0 0 0 0 0 1 ⎥ ⎢𝑥3 0⎥ ⎢ 00⎥
⎢𝑧̇ 0⎥ ⎢ 0 0 1 0 –1 –1 ⎥ ⎢𝑥̇3 0⎥ ⎢ 00⎥
⎣ 6⎦ ⎣ ⎦⎣ ⎦ ⎣ ⎦

⎡ 𝑥1 ⎤
⎢ ⎥
⎢𝑥̇1 ⎥
⎢ ⎥
⎢𝑥 ⎥
⎢ 2⎥
𝑦=[ 0 0 0 0 1 0 ]⎢ ⎥
⎢𝑥̇2 ⎥
⎢ ⎥
⎢ 𝑥3 ⎥
⎢ ⎥
⎢𝑥̇3 ⎥
⎣ ⎦
where D = 0.
𝑋3 (𝑠)
2. Derive the transfer function, , from the equations of motion for the translational mechanical system
𝐹 (𝑠)
shown in Fig. 3.1.
Solution 2:
Recall the transformed system of equations.
(𝑠2 + 𝑠 + 1)𝑋1 (𝑠) − 𝑠𝑋2 (𝑠) = 𝐹 (𝑠)
−𝑠𝑋1 (𝑠) + (𝑠2 + 𝑠 + 1)𝑋2 (𝑠) − 𝑋3 (𝑠) = 0
−𝑋2 (𝑠) + (𝑠2 + 𝑠 + 1)𝑋3 (𝑠) = 0
To solve for 𝑋3 (𝑠), use Cramer’s rule where
|(𝑠2 + 𝑠 + 1) −𝑠 0 |
∆=| −𝑠 (𝑠2 + 𝑠 + 1) −1 |
| |
| 0 −1 (𝑠 + 𝑠 + 1)|
2

∆ = (𝑠2 + 𝑠 + 1) (𝑠2 + 𝑠 + 1)2 − 1 + 𝑠 −𝑠(𝑠2 + 𝑠 + 1) + 0


∆ = (𝑠2 + 𝑠 + 1)(𝑠4 + 2𝑠3 + 3𝑠2 + 2𝑠) − (𝑠4 + 𝑠3 + 𝑠2 )
∆ = (𝑠6 + 3𝑠5 + 6𝑠4 + 7𝑠3 + 5𝑠2 + 2𝑠) − (𝑠4 + 𝑠3 + 𝑠2 )
∆ = 𝑠6 + 3𝑠5 + 5𝑠4 + 6𝑠3 + 4𝑠2 + 2𝑠
∆ = 𝑠(𝑠5 + 3𝑠4 + 5𝑠3 + 6𝑠2 + 4𝑠 + 2)

(𝑠2 + 𝑠 + 1) −𝑠 𝐹 (𝑠)
∆3 = −𝑠 (𝑠2 + 𝑠 + 1) 0
0 −1 0
∆3 = [𝐹 (𝑠)](𝑠 − 0) − 0 + 0
∆3 = 𝑠𝐹 (𝑠)
Then,
∆3 𝑠𝐹 (𝑠) 𝐹 (𝑠)
𝑋3 (𝑠) = = 5 =
∆ 𝑠(𝑠 + 3𝑠4 + 5𝑠3 + 6𝑠2 + 4𝑠 + 2) 𝑠5 + 3𝑠4 + 5𝑠3 + 6𝑠2 + 4𝑠 + 2
Thus,
𝐹 (𝑠)
𝑋3 (𝑠) 𝑠5 + 3𝑠4 + 5𝑠3 + 6𝑠2 + 4𝑠 + 2
=
𝐹 (𝑠) 𝐹 (𝑠)
𝑋3 (𝑠) 1
= 5
𝐹 (𝑠) 𝑠 + 3𝑠 + 5𝑠 + 6𝑠2 + 4𝑠 + 2
4 3
1.4 LAB
1. Use MATLAB to generate LTI state-space representation derived in Prelab 1.
Program and Result:
2. Use MATLAB to convert the LTI state-space representation found in Lab 1 to the LTI transfer function
found in Prelab 2.
Program and Result:

1.5 POSTLAB
1. Compare your transfer functions as found from Prelab 2 and Lab 2.
No doubt that Prelab 2 and Lab2 are coincident. After undergoing different methods, the final answer is
just the same.

2. Discuss the use of MATLAB to create LTI state-space representations and the use of MATLAB to convert
these representations to transfer functions.
In Lab 2, hand solving is crucial to make the LTI state-space representation of this system before
programming with MATLAB; otherwise, you have no idea what elements in the matrices A, B, C and D
would be. Always pay attention to the number of rows n and columns m of each matrix, where matrix A is
n by m (square matrix), matrix B is 1 by m, matrix C is n by 1 and matrix D is 1 by 1. When the following
matrices have been programmed, a command line sys = ss(A, B, C, D) converts this state-space
representation to transfer function instantly. To simplify and finalize the transfer fraction, minreal(sys2)
is added.

You might also like