0% found this document useful (0 votes)
34 views9 pages

National University: 551 M.F. Jhocson ST., Sampaloc, Manila

The document contains the answers to 13 questions regarding representing electrical, mechanical, and other systems using MATLAB. Various transfer function representations are derived including: 1) Transfer functions using mesh analysis and Cramer's rule 2) State-space and transfer function models using symbolic math toolbox 3) Defining transfer functions as tf, zpk, and state-space objects The student shows the steps to derive transfer functions from circuits, mechanical systems and differential equations. Code examples are provided to define the derived transfer functions as MATLAB objects including tf, zpk and state-space models.

Uploaded by

John Ian Santos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views9 pages

National University: 551 M.F. Jhocson ST., Sampaloc, Manila

The document contains the answers to 13 questions regarding representing electrical, mechanical, and other systems using MATLAB. Various transfer function representations are derived including: 1) Transfer functions using mesh analysis and Cramer's rule 2) State-space and transfer function models using symbolic math toolbox 3) Defining transfer functions as tf, zpk, and state-space objects The student shows the steps to derive transfer functions from circuits, mechanical systems and differential equations. Code examples are provided to define the derived transfer functions as MATLAB objects including tf, zpk and state-space models.

Uploaded by

John Ian Santos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

NATIONAL UNIVERSITY

551 M.F. JHOCSON ST., SAMPALOC, MANILA

COLLEGE OF ENGINEERING

Santos, John Ian V.


Name/Section Rating
ECEP08
Date performed October 22, 2018
Date submitted October 29, 2018

EXPERIMENT NO. 3
SYSTEM REPRESENTATION USING MATLAB

Question 1: Use mesh analysis to write transfer functions 𝐼1(𝑠)/𝑉(𝑠), 𝐼2(𝑠)/𝑉(𝑠) and 𝐼3(𝑠)/𝑉(𝑠) for the
electrical network shown above. Show the details of your derivation on your report.

Answer:
𝐿𝑜𝑜𝑝 1: (2𝑠 + 2) − (2𝑠 + 1) − 1 = 𝑉
𝐿𝑜𝑜𝑝 2: −(2𝑠 + 1) + (9𝑠 + 1) − 4𝑠 = 0
1
𝐿𝑜𝑜𝑝 3: − 1 − 4𝑠 + (4𝑠 + 1 + ) = 0
𝑠

𝑆𝑜𝑙𝑣𝑖𝑛𝑔 𝑓𝑜𝑟 𝑒𝑎𝑐ℎ 𝑐𝑢𝑟𝑟𝑒𝑛𝑡 𝑢𝑠𝑖𝑛𝑔 𝑐𝑟𝑎𝑚𝑒𝑟 ′ 𝑠 𝑟𝑢𝑙𝑒 𝑤𝑒 𝑔𝑒𝑡:

𝐼1(𝑠) 20𝑠 3 + 13𝑠 2 + 10𝑠 + 1


=
𝑉𝑠 24𝑠 4 + 30𝑠 3 + 17𝑠 2 + 16𝑠 + 1

𝐼2(𝑠) 8𝑠 3 + 10𝑠 2 + 3𝑠 + 1
=
𝑉𝑠 24𝑠 4 + 30𝑠 3 + 17𝑠 2 + 16𝑠 + 1

𝐼3(𝑠) 8𝑠 2 + 13𝑠 + 1
=
𝑉𝑠 24𝑠 4 + 30𝑠 3 + 17𝑠 2 + 16𝑠 + 1

Question 2. Explain the method used in the code above.

Answer: The transfer functions, currents, and voltage are put in a matrix. Then the inverse of Matrix A
multiplied by Matrix C will be substituted to the symbols of Matrix B. The answer will then be printed
using the pretty function.

Page | 1
Question 3: What are the currents 𝐼1(𝑠), 𝐼2(𝑠), and 𝐼3(𝑠)?

Answer:

/ 3 2 \
| V (20 s + 13 s + 10 s + 1) |
| ---------------------------- |
| #1 |
| |
| 3 2 |
| V (8 s + 10 s + 3 s + 1) |
| -------------------------- |
| #1 |
| |
| 2 |
| V s (8 s + 13 s + 1) |
| --------------------- |
\ #1 /

where

4 3 2
#1 == 24 s + 30 s + 17 s + 16 s + 1

Question 4: What are the transfer functions 𝐼1(𝑠)/𝑉(𝑠), 𝐼2(𝑠)/𝑉(𝑠), and 𝐼3(𝑠)/𝑉(𝑠) based on the results
taken from Question 3? Check if they are similar to the results of Question 1.

Answer:

𝐼1(𝑠) 20𝑠 3 + 13𝑠 2 + 10𝑠 + 1


=
𝑉𝑠 24𝑠 4 + 30𝑠 3 + 17𝑠 2 + 16𝑠 + 1

𝐼2(𝑠) 8𝑠 3 + 10𝑠 2 + 3𝑠 + 1
=
𝑉𝑠 24𝑠 4 + 30𝑠 3 + 17𝑠 2 + 16𝑠 + 1

𝐼3(𝑠) 8𝑠 2 + 13𝑠 + 1
=
𝑉𝑠 24𝑠 4 + 30𝑠 3 + 17𝑠 2 + 16𝑠 + 1

Yes, they are similar

Page | 2
Question 5: Find the transfer functions 𝐺1(𝑠) = 𝑋1(𝑠)/𝐹(𝑠), 𝐺2(𝑠) = 𝑋2(𝑠)/𝐹(𝑠) and 𝐺3(𝑠) = 𝑋3(𝑠)/𝐹(𝑠) for
the mechanical system shown below. In your report, write the codes you have used to derive the transfer
function and define the transfer function into MATLAB.

Answer:
% Mechanical System
symssX1X2X3F
A = [(s^2 + s + 1) -s 0; -s (s^2 + s + 1) -1; 0 -1 (s^2 + s + 1)];
B = [X1;X2;X3];
C = [F;0;0];
B = inv(A)*C;
pretty(B)

𝑋1(𝑠) 𝑠 3 + 2𝑠 2 + 3𝑠 + 2
= 5
𝐹𝑠 𝑠 + 3𝑠 4 + 5𝑠 3 + 6𝑠 2 + 4𝑠 + 2

𝑋2(𝑠) 1
= 3 2
𝐹𝑠 𝑠 + 2𝑠 + 2𝑠 + 2

𝑋3(𝑠) 1
= 5
𝐹𝑠 𝑠 + 3𝑠 + 5𝑠 + 6𝑠 2 + 4𝑠 + 2
4 3

Page | 3
Question 6: Find the transfer function 𝑋3(𝑠)/𝐹(𝑠) for the mechanical system shown below. In your report,
write the codes you have used to derive the transfer function and define the transfer function into
MATLAB.

Answer:
% Mechanical System
symssX1X2X3F
A = [(4*s^2 + 4*s + 8) -4 -2*s;-4 (5*s^2 + 3*s + 4) -3*s;-2*s -3*s (5*s^2 + 5*s + 5)];
B = [X1;X2;X3];
C = [0;F;0];
B = inv(A)*C;
pretty(B)

𝑋1(𝑠) 13𝑠 2 + 10𝑠 + 10


=
𝐹𝑠 25𝑠 6 + 65𝑠 5 + 136𝑠 4 + 163𝑠 3 + 121𝑠 2 + 70𝑠 + 20

𝑋2(𝑠) 5𝑠 4 + 10𝑠 3 + 19𝑠 2 + 15𝑠 + 10


=
𝐹𝑠 25𝑠 6 + 65𝑠 5 + 136𝑠 4 + 163𝑠 3 + 121𝑠 2 + 70𝑠 + 20

𝑋3(𝑠) 3𝑠 3 + 3𝑠 2 + 8𝑠
=
𝐹𝑠 25𝑠 6 + 65𝑠 5 + 136𝑠 4 + 163𝑠 3 + 121𝑠 2 + 70𝑠 + 20

Question 7: Find the transfer function 𝜃𝐿(𝑠)/𝑇(𝑠) for the mechanical system shown below. In your report,
write the codes you have used to derive the transfer function and define the transfer function into
MATLAB.

Answer:

Page | 4
Question 8: Represent the transfer function as a MATLAB object. Write the codes.

Answer:
>> num = [ 1 17 99 223 140 ]; den = [ 1 32 363 2092 5052 4320 ];
>> G = tf(num,den)

G =

s^4 + 17 s^3 + 99 s^2 + 223 s + 140


-------------------------------------------------
s^5 + 32 s^4 + 363 s^3 + 2092 s^2 + 5052 s + 4320

Continuous-time transfer function.

Question 9: Write a transfer function 𝐺(𝑠) = 𝑉0(𝑠)/𝑉(𝑠) for the circuit shown and define its model as a
transfer function object in MATLAB. In your report, write the codes you have used to derive the transfer
function and define the transfer function into MATLAB.

Answer:
% Mesh Currents
symssI1I2I3V
A = [(4*s + 4) -(4*s+2) -2;-(4*s+2) (10*s + 14) -(6*s+4);-2 -(6*s+4) (6*s^2 +
(1/9*s) + 5)];
B = [X1;X2;X3];
C = [V;0;0];
B = inv(A)*C;
pretty(B)

Since I2 = Vo

𝑉𝑜(𝑠) 108𝑠 3 + 56𝑠 2 + 145𝑠 + 81


=
𝑉𝑠 324𝑠 4 + 762𝑠 3 + 20𝑠 2 − 5𝑠 + 243

>> num = [108 56 145 81]; den = [324 762 20 -5 243];


>> G = tf(num,den)

G =

108 s^3 + 56 s^2 + 145 s + 81


--------------------------------------
324 s^4 + 762 s^3 + 20 s^2 - 5 s + 243

Continuous-time transfer function.

Page | 5
Question 10: Represent the transfer function as a MATLAB ZPK object. In your report, write the codes
you have used to derive the transfer function and define the transfer function into MATLAB.

Answer:
% Create a ZPK model
gain = 70;
zeroes = [42/70];
poles = roots([1 8 17 80 42]);
G1 = zpk(zeroes,poles,gain)

G1 =

70 (s-0.6)
--------------------------------------------
(s+7.077) (s+0.5781) (s^2 + 0.3452s + 10.27)

Continuous-time zero/pole/gain model.

Question 11: Represent the transfer function as a MATLAB ZPK object. In your report, write the codes
you have used to derive the transfer function and define the transfer function into MATLAB.

Answer:
% Create a ZPK model
gain = 50;
zeroes = [1.5];
poles = [0 0.5 10];
G1 = zpk(zeroes,poles,gain)

G1 =

50 (s-1.5)
----------------
s (s-0.5) (s-10)

Continuous-time zero/pole/gain model.

Question 12: Represent the transfer function as a MATLAB ZPK object. In your report, write the codes
you have used to derive the transfer function and define the transfer function into MATLAB.

Answer:
% Create a ZPK model
gain = 10;
zeroes = roots([1 -4 5.333]);
poles = [10 [roots([1 4 5.333])]'];
G1 = zpk(zeroes,poles,gain)

G1 =

10 (s^2 - 4s + 5.333)
-------------------------
(s-10) (s^2 + 4s + 5.333)

Continuous-time zero/pole/gain model.

Page | 6
Question 13: Represent the system represented by the differential equation as a state-space model
object in MATLAB. First, show how the matrices 𝐀, 𝐁, 𝐂, and 𝐃 for this system is to be obtained, then
show the codes that lets you define the state-space model.

Answer:
𝑠 3 + 9𝑠 2 𝐶 + 26𝑠𝐶 + 24𝐶 = 24𝑅
𝑥1 = 𝑐
𝑑𝑐
𝑥2 =
𝑑𝑡
𝑑2 𝑐
𝑥3 = 2
𝑑𝑡
0 𝑥2 0 0
𝑥 = 0 0 𝑥3 0
−24𝑥1 − 26𝑥2 − 9𝑥3 24𝑟

𝑥1
𝑦=1 0 0 𝑥 𝑥2 + [0][𝑣]
𝑥3
0 1 0
𝐴= 0 0 1
−24 − 26 − 9

0
𝐵= 0
24
𝐶=1 0 0
𝐷 = [0]

% Create a state space model


A = [0 1 0;0 0 1;-24 -26 -9]; B = [0;0;24]; C = [1 0 0]; D = [0];
G = ss(A,B,C,D)

G =

A =
x1 x2 x3
x1 0 1 0
x2 0 0 1
x3 -24 -26 -9

B =
u1
x1 0
x2 0
x3 24

C =
x1 x2 x3
y1 1 0 0

D =
u1
y1 0

Continuous-time state-space model.

Page | 7
Question 14: Represent the system represented by the differential equation as a state-space model
object in MATLAB. First, show how the matrices 𝐀, 𝐁, 𝐂, and 𝐃 for this system is to be obtained, then
show the codes that lets you define the state-space model.

Answer:

Question 15: A system is represented by the transfer function as shown below. Rewrite this as a state
space model and define as a MATLAB state space model object. First, show how the matrices 𝐀, 𝐁, 𝐂,
and 𝐃 for this system is to be obtained, then show the codes that lets you define the state-space model.

Page | 8
Answer:
0 10 0 0
𝑥= 0 0 10 0
0 0 01 0
−13 − 5 − 1 − 51

𝑐 = 108 0 0 0

0 1 0 0
𝐴= 0 0 1 0
0 0 0 1
−13 − 5 − 1 − 5

0
𝐵= 0
0
1
𝐶 = 108 0 0 0
𝐷 = [0]
% Create a state space model
A = [0 1 0 0;0 0 1 0;0 0 0 1;-13 -5 -1 -5]; B = [0;0;0;1]; C = [10 8 0 0]; D =
[0];
G = ss(A,B,C,D)

G =

A =
x1 x2 x3 x4
x1 0 1 0 0
x2 0 0 1 0
x3 0 0 0 1
x4 -13 -5 -1 -5

B =
u1
x1 0
x2 0
x3 0
x4 1

C =
x1 x2 x3 x4
y1 10 8 0 0

D =
u1
y1 0

Continuous-time state-space model.

Conclusions and Recommendations:

The Symbolic Math Toolbox provides functions for solving, plotting, and manipulating symbolic
math equations. It can be used to solve the transfer functions of electrical, mechanical or
electromechanical systems. Control Systems Toolbox functions can be used to represent dynamic
systems using their transfer function, zero pole-gain, state space and frequency response.

Page | 9

You might also like