Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Feedback and Control Systems Laboratory: ECEA107L/E02/2Q2021

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 26

FEEDBACK AND CONTROL SYSTEMS

LABORATORY
ECEA107L/E02/2Q2021

Activity No. 2

Systems Generation, Retrieval, and Interconnection

Submitted by: MACARAEG, Kim Andre S.


Student Number: 2018162135
Date Performed: December 03, 2020
Date Submitted: December 11, 2020

Engr. Glenn V. Magwili


- Instructor –
FINAL DATASHEET
Procedure:

1. Generate the following systems:


a. sysa is a system with transfer function
X s 2+ 5
G ( s )= 2
s + 5 s+ X
Commands used:
>> X = 12; %Assigned X
>> NUM_1a = [X, 0, 5];
>> DEN_1a = [1, 5, X];
>> sysa = tf(NUM_1a, DEN_1a)

Matlab Output:
sysa =

12 s^2 + 5
--------------
s^2 + 5 s + 12

Continuous-time transfer function.

a. sysb is a system with a gain of 12, poles at s=-2 and s=-6 and zeroes at s=-5
and s= -X
Commands used:
>> X = 12; %Assigned X
>> Z_1b = [-5 -X];
>> P_1b = [-2 -6];
>> K_1b = [12];
>> sysb = zpk(Z_1b,P_1b, K_1b)

Matlab Output:
sysb =

12 (s+5) (s+12)
---------------
(s+2) (s+6)

Continuous-time zero/pole/gain model.


b. sysc is a system with matrices
A= X 1 , B= 0 , C=[ −1 X ] ,∧D=0
[
−4 −3 ] [] 2
Commands used:
>> X = 12; %Assigned X
>> A_1c = [X 1; -4 -3];
>> B_1c = [0 ; 2];
>> C_1c = [-1 X];
>> D_1c = 0;
>> sysc = ss(A_1c, B_1c, C_1c, D_1c)

Matlab Output:
sysc =

A =
x1 x2
x1 12 1
x2 -4 -3

B =
u1
x1 0
x2 2

C =
x1 x2
y1 -1 12

D =
u1
y1 0

Continuous-time state-space model.


c. sysd is a system with a set of frequencies with corresponding system
responses

Frequency (Hz) Response


1000 X -0.9+j0.75
1500 X -0.5+j0.45
2000 X -0.45+j0.65

Commands used:
>> X = 12; %Assigned X
>> RESPONSE_1d = [-0.9+j*0.75, -0.5+j*0.45, -0.45+j*0.65 ];
>> FREQUENCY_1d = [2*pi*1000*X, 2*pi*1500*X, 2*pi*2000*X];
>> sysd = frd(RESPONSE_1d, FREQUENCY_1d)

Matlab Output:
sysd =

Frequency(rad/s) Response
---------------- --------
7.540e+04 -0.9000 + 0.7500i
1.131e+05 -0.5000 + 0.4500i
1.508e+05 -0.4500 + 0.6500i

Continuous-time frequency response.

2. Generate the system given by the transfer function :

5 s2−8 s+3
H ( s )=
3 s 2−Xs−8
Commands used:
>> X = 12; %Assigned X
>> NUM_2 = [5 -8 3];
>> DEN_2 = [3 -X -8];
>> sys = tf(NUM_2, DEN_2)

Matlab Output:
sys =

5 s^2 - 8 s + 3
----------------
3 s^2 - 12 s - 8

Continuous-time transfer function.


a. Retrieve the numerator and denominator of the system.

Command used:
>> [NUM_2a, DEN_2a] = tfdata(sys,'v')
Matlab Output:
NUM_2a =

5 -8 3

DEN_2a =

3 -12 -8

b. Retrieve the gain, poles and zeroes of the system.

Command used:
>> [Z_2b, P_2b, K_2b] = zpkdata(sys,'v')

Matlab Output:
Z_2b =

1.0000
0.6000

P_2b =

4.5820
-0.5820

K_2b =

1.6667
c. Retrieve the state space parameters of the system.

Command used:
>> [A_2c, B_2c, C_2c, D_2c] = ssdata(sys)

Matlab Output:
A_2c =
4.0000 1.3333
2.0000 0

B_2c =

2
0

C_2c =

2.0000 1.3611

D_2c =

1.6667

d. Retrieve the frequency response data of the system.

Command used:
>> [RESPONSE, FREQUENCY] = frdata(sys)

Matlab Output:
Check for missing argument or incorrect argument data type
in call to function 'frdata'.

Explanation: Applicable only for FRD data.


3. Get the overall transfer function of the systems below
a.

Commands used:
>> X = 12; %Assigned X
>> sys3a_1 = tf([1 3 -3], [1 0 5 0 23]);
>> sys3a_2 = tf([1 5 4], [1 2 5 X]);
>> sys3a_3 = tf([1 4 3], [1 4 8 0]);
>> sys3a_4 = tf([1 6 0], [6 6 X]);
>> sys3a_5 = series(sys3a_2, sys3a_3);
>> sys3a_6 = parallel(sys3a_1, sys3a_5);
>> sys3a_7 = feedback(sys3a_6, sys3a_4, -1);
>> sys3a = sys3a_7

Matlab Output:
sys3a =

12 s^10 + 120 s^9 + 540 s^8 + 1638 s^7 + 3864 s^6

+ 7530 s^5 + 11766 s^4 + 13716 s^3 + 12666 s^2

+ 6756 s + 3312

-----------------------------------------------------------

6 s^12 + 42 s^11 + 206 s^10 + 726 s^9 + 2252 s^8

+ 5653 s^7 + 12327 s^6 + 23342 s^5 + 36897 s^4


+ 49055 s^3 + 40362 s^2 + 28152 s

Continuous-time transfer function.

b.

Commands used:
>> X = 12; %Assigned X
>> sys3b_1 = tf([1],[2 0 X]);
>> sys3b_2 = tf([3 0 0], [1 0 4]);
>> sys3b_3 = tf([1],[2 -5 1]);
>> sys3b_4 = tf([1 0 0], [X 4]);
>> sys3b_5 = feedback(sys3b_1, sys3b_2, +1);
>> sys3b_6 = series(sys3b_5, sys3b_3);
>> sys3b_7 = feedback(sys3b_6, sys3b_4, -1);
>> sys3b = sys3b_7
Matlab Output:
sys3b =

12 s^3 + 4 s^2 + 48 s + 16

----------------------------------------------------------

48 s^7 - 104 s^6 + 392 s^5 - 875 s^4 + 1016 s^3

- 2424 s^2 - 384 s + 192

Continuous-time transfer function.


c.

Commands used:
>> X = 12; %Assigned X
>> Zeros_1 = [-1 -1];
>> Poles_1 = [0 -2 -3];
>> K_1 = X;
>> sys3c_1=zpk(Zeros_1, Poles_1, K_1);
>> Zeros_2 = [-2];
>> Poles_2 = [0 -4];
>> K_2 = [2];
>> sys3c_2 = zpk(Zeros_2, Poles_2, K_2);
>> A = [X 1; -4 -3];
>> B = [0; 2];
>> C = [-1 X];
>> D = 0;
>> sys3c_3 = ss(A, B, C, D);
>> sys3c_4 = tf(4, 1);
>> sys3c_5 = tf([X 0 0], [1 4 4]);
>> sys3c_6 = tf([X], [1 0]);
>> sys3c_7 = tf([1], [1 0]);
>> sys3c_8 = series(sys3c_4,sys3c_3);
>> sys3c_9 = parallel(sys3c_8,sys3c_1);
>> sys3c_10 = feedback(sys3c_9,sys3c_5, -1);
>> sys3c_11 = series(sys3c_2, sys3c_10);
>> sys3c_12 = feedback(sys3c_11, sys3c_7);
>> sys3c_13 = series(sys3c_12, sys3c_6);
>> [NUM_3c, DEN_3c] = ss2tf(A,B,C,D);
>> sys3c = tf(NUM_3c, DEN_3c)
Matlab Output:
sys3c =

24 s - 290
--------------
s^2 - 9 s - 32

Continuous-time transfer function.


Proof of performance of the activity
SAMPLE COMPUTATIONS
1. Generate the following systems:
d. sysa is a system with transfer function
X s 2+ 5
G ( s )= 2
s + 5 s+ X
Commands used:
>> X = 12; %Assigned X
>> NUM_1a = [X, 0, 5];
>> DEN_1a = [1, 5, X];
>> sysa = tf(NUM_1a, DEN_1a)

Matlab Output:
sysa =

12 s^2 + 5
--------------
s^2 + 5 s + 12

Continuous-time transfer function.

2. Generate the system given by the transfer function :

5 s2−8 s+3
H ( s )=
3 s 2−Xs−8
Commands used:
>> X = 12; %Assigned X
>> NUM_2 = [5 -8 3];
>> DEN_2 = [3 -X -8];
>> sys = tf(NUM_2, DEN_2)

Matlab Output:
sys =

5 s^2 - 8 s + 3
----------------
3 s^2 - 12 s - 8

Continuous-time transfer function.


a. Retrieve the numerator and denominator of the system.

Command used:
>> [NUM_2a, DEN_2a] = tfdata(sys,'v')
Matlab Output:
NUM_2a =

5 -8 3

DEN_2a =

3 -12 -8

3. Get the overall transfer function of the systems below


d.

Commands used:
>> X = 12; %Assigned X
>> sys3a_1 = tf([1 3 -3], [1 0 5 0 23]);
>> sys3a_2 = tf([1 5 4], [1 2 5 X]);
>> sys3a_3 = tf([1 4 3], [1 4 8 0]);
>> sys3a_4 = tf([1 6 0], [6 6 X]);
>> sys3a_5 = series(sys3a_2, sys3a_3);
>> sys3a_6 = parallel(sys3a_1, sys3a_5);
>> sys3a_7 = feedback(sys3a_6, sys3a_4, -1);
>> sys3a = sys3a_7
Matlab Output:
sys3a =

12 s^10 + 120 s^9 + 540 s^8 + 1638 s^7 + 3864 s^6

+ 7530 s^5 + 11766 s^4 + 13716 s^3 + 12666 s^2

+ 6756 s + 3312

-----------------------------------------------------------

6 s^12 + 42 s^11 + 206 s^10 + 726 s^9 + 2252 s^8

+ 5653 s^7 + 12327 s^6 + 23342 s^5 + 36897 s^4

+ 49055 s^3 + 40362 s^2 + 28152 s

Continuous-time transfer function.


HOMEWORK
1. Generate the following systems:
a. sys1 = a systems with transfer function of
2
2s +6
G ( s )= 2
s −5 s +3
Commands used:
>>num_coeffs = [2 0 6];
>>den_coeffs = [1 -5 3];
>>sys1 = tf(num_coeffs,den_coeffs)

Matlab Output:
sys1 =

2 s^2 + 6
-------------
s^2 - 5 s + 3

Continuous-time transfer function.

b. sys2 = a system with a gain of 2, poles at s=3 and s=-5 and zeroes at s=-2
and s=5
Commands used:
>>Z = [-2 5];
>>P = [3 -5];
>>K = [2];
>>sys2 = zpk(Z,P,K);

Matlab Output:
sys2 =

2 (s+2) (s-5)
-------------
(s-3) (s+5)

Continuous-time zero/pole/gain model.

2. Generate the system give by the transfer function:


3 s 2+3 s−1
H ( s )= 2
s + 2 s−2
Commands used:
>>num_coeffs = [3, 3, -1];
>>den_coeffs = [1 2 -2];
>>sys = tf(num_coeffs, den_coeffs)
Matlab Output:
sys =

3 s^2 + 3 s - 1
---------------
s^2 + 2 s - 2

Continuous-time transfer function.


a. retrieve the numerator and denominator of the transfer function
Commands used:
>> [NUM, DEN] = tfdata(sys, 'v')

Matlab Output:
NUM =

3 3 -1

DEN =

1 2 -2
b. retrieve the gain, poles and zeroes position of the system given above
Commands used:
>> [Z,P,K] = zpkdata(sys,'v')

Matlab Output:
Z =

-1.2638
0.2638

P =

-2.7321
0.7321

K =

3
c. retrieve the state space parameters of the system given above
Commands used:
>>[A,B,C,D] = ssdata(sys)

Matlab Output:
A =

-2 2
1 0

B =

4
0

C =

-0.7500 1.2500

D =

3
3. Get the overall transfer function of the systems below
a.

Commands used:
>>sys1 = tf([1 0 0],[2 0 1]);
>>sys2 = tf([1],[1 0 2]);
>>sys3 = tf([2 0 3],[1 2 3 4]);
>>sys4 = series(sys1,sys2);
>>sys = parallel(sys4,sys3)

Matlab Output:
sys =

4 s^6 + s^5 + 18 s^4 + 3 s^3 + 23 s^2 + 6

----------------------------------------------------------

2 s^7 + 4 s^6 + 11 s^5 + 18 s^4 + 17 s^3 + 24 s^2

+ 6 s + 8

Continuous-time transfer function.


b.

Commands used:
>>sys1 = tf([3 0 0],[2 0 4]);
>>sys2 = tf([1],[1 0 4]);
>>sys3 = tf([1 0 0],[2 5 1]);
>>sys4 = tf([1],[3 4]);
>>sys5 = parallel(sys1,sys2);
>>sys6 = series(sys5,sys3);
>>sys = feedback(sys6,sys4,-1)

Matlab Output:
sys =

9 s^7 + 12 s^6 + 42 s^5 + 56 s^4 + 12 s^3 + 16 s^2

----------------------------------------------------------

12 s^7 + 49 s^6 + 118 s^5 + 298 s^4 + 372 s^3 + 420 s^2

+ 368 s + 64

Continuous-time transfer function.


SEATWORK
4. Create a Matlab M-File
[sys1,sys2,sys3,num,den,zero,pole,gain,A,B,C,D]=seriesrlc(R,L,C)

Matlab M-File
function [sys,sys1,sys2,num,den,zero,pole,gain,A,B,C,D] =
seriesrlc(R,L,C)
format shortEng
syms c(t)
syms I(s)
syms V_C(s)
syms t
syms s
syms G(S)

integro_diffrential_equation = c(t)*R +
L*diff(c(t),t,1)+(1/C)*int(c(t),0,inf)==24;
laplace_transform0 = laplace(integro_diffrential_equation);
laplace_transform1 = subs(laplace_transform0,
[laplace(c(t),t,s), laplace(int(c(t),0,inf)), c(0)],
[I(s),I(s)/s, 0]);
laplace_transform2 = isolate(laplace_transform1,I(s));

Vc(S)=V_C(s) == rhs(laplace_transform2)*(1/(s*C));
sys=vpa((G(S) == rhs(Vc(S))/rhs(laplace_transform1)),3);

[NUM,DEN]=numden(rhs(sys));
gain = sym2poly(NUM);
num = gain;
den=sym2poly(DEN);
zero = roots(num);
pole = roots(den);
sys = tf(num,den);

[A,B,C,D]=tf2ss(num,den);

sys1 = ss(A,B,C,D);

[z,p,k] = tf2zp(gain*num,den);

sys2 = zpk(z,p,k);

end

5. Test the function seriesrlc using R=250Ω, L=100 mH and C=100 µF.

Matlab Command:
>>[sys,sys1,sys2,num,den,zero,pole,gain,A,B,C,D] =
seriesrlc(250,100*(10^-3),100*(10^-6))

Matlab Outputs:

sys =

100000
---------------------
s^2 + 2500 s + 100000

Continuous-time transfer function.

sys1 =

A =
x1 x2
x1 -2500 -1e+05
x2 1 0

B =
u1
x1 1
x2 0

C =
x1 x2
y1 0 1e+05

D =
u1
y1 0

Continuous-time state-space model.

sys2 =

1e+10
------------------
(s+2459) (s+40.66)

Continuous-time zero/pole/gain model.

num =

100.0000e+003

den =

1.0000e+000 2.5000e+003 100.0000e+003

zero =

0×1 empty double column vector

pole =

-2.4593e+003
-40.6613e+000

gain =

100.0000e+003
A =

-2.5000e+003 -100.0000e+003
1.0000e+000 0.0000e+000

B =

1.0000e+000
0.0000e+000

C =

0.0000e+000 100.0000e+003

D =

0.0000e+000
INTERPRETATION / ANALYSIS
Characterizing systems using different forms of systems representation, system
transformation and system interconnection were the primary goals of the experiment. As
C(s)
it was learned a system can be characterized by its transfer function G ( s )= .
R(s)
K ( s−z 1 )( s−z 2 ) ( s−z 3 ) …( s−z m)
Transfer function can also be written in G ( s )= , where z, p,
( s− p1 ) ( s−p 2) ( s− p3 ) …( s−p n)
and K are the zeroes, poles and gain respectively. Moreover, control systems nowadays
can be represented in the time-domain and this representation is called state-space
representation. This representation of a system appears in matrix form ẋ= Ax+ Bu and
y=Cx + Du. Lastly, a system could also be represented by its frequency response in
continuous form or at discrete points.

For procedure 1.a, it is required to generate a system with a given transfer


function. This was accomplished by using the tf(NUM,DEN) function which it creates a
continuous-time transfer function with numerator coefficients, NUM and denominator
12 s2 +5
coefficients, DEN. The result obtain was 2 which is a tf object.
s + 5 s+12

For procedure 1.b, it is required to generate a system with a gain of 12, poles at
s=-2 and s=-6 and zeroes at s=-5 and s=-X. This problem was accomplished by using
the zpk(Z,P,K) function also known at zero-pole-gain function. It primarily creates a
continuous-time zero-pole-gain (ZPK) model SYS with zeroes vector Z, poles vector P
and gain K. The obtained result from question 1.b is a zpk object.

For procedure 1.c, it is required to generate a system with a given matrix


A,B,C,D. This problem was accomplished by using the function ss(A,B,C,D) where
primarily creates a continuous-time state-space model with matrices A,B,C,D. The result
obtained is a ss object. As it was noted, A is the system matrix, B is the input matrix, C
is the output matrix and D is the feedforward matrix.

For procedure 1.d, it is required to generate a system with a set of frequencies


with corresponding system responses. The problem was accomplished using the
function frd(RESPONSE, FREQS). The primary function of this function is it creates an
frd model system with response data in the RESPONSE vector at frequency points
given in FREQS vector. Based on the result, it was observed that the output is an frd
model.

For procedure 2.a, it is required to retrieve the numerator and denominator of the
system that was generated earlier. The problem was solved by using the function
tfdata(SYS,’v’) where the parameter SYS was the transfer function defined earlier. The
function will return the numerator coefficient and denominator coefficients of the transfer
function that was defined earlier. As it was also noted that the system will be first
converted to transfer function if it is in another kind of representation. The numerator
result and denominator result were declared in NUM and DEN variable, respectively.
For procedure 2.b, it is required to retrieve the gain, poles, and zeroes of the
generated system earlier. The problem was solved by using the function
zpkdata(SYS,’v’) where the variable SYS was the transfer function defined earlier. The
function that was used will return the zeros, poles and gain for each I/O channel of the
LTI model system. The obtained zeroes of the system were 1 and 0.6, poles were 4.582
and -0.5820 and gain was 1.6667.

For procedure 2.c, it is required to retrieve the state space parameters of the
given transfer function earlier. To obtain the result, the function ssdata(SYS) was used
where it primarily retrieves the matrix data A,B,C,D for the space state model of the
defined transfer function earlier. Since system defined earlier is a transfer function, it
was first converted to a space-state representation to make the space-state model.

For procedure 2.d, it is required to retrieve the frequency response data of the
given transfer function. Since the given is not an FRD data, therefore the result would
show that there is an incorrect argument data type to call the function frdata(SYS). If the
data type is correct, the function will return the response data and frequency samples of
the frequency response data (FRD) model of the system.

For procedure 3.a, 3.b, and 3.c, it is required to get the overall transfer function of
the given block diagrams. In order to reduce the block diagram, different methods for
connecting systems were used. The series(G1,G2) function will connect two LTI system
models G1 and G2 in series. Note that G1, and G2, are only the parameter to represent
a single system. Two LTI model system can also be connected in parallel using the
function parallel(G1,G2). Meanwhile, the function feedback(G1,G2,SIGN) will compute
an LTI model system for the closed-loop feedback system. Furthermore, the feedback
can be positive or negative so the SIGN parameter can be +1 or -1. Based on the
results obtained, it was observed that the block diagrams were simplified into a single
transfer function that describes the whole block diagram for each specific question. All
the results obtained was ensured that it was returned in a transfer function
representation.
CONCLUSION
To wrap up, the experiment deals with systems generation, retrieval and
interconnection. an LTI system can be represented into a transfer function. The transfer
K ( s−z 1 )( s−z 2 ) ( s−z 3 ) …( s−z m)
function can also be rewritten as G ( s )= where z, p, and K
( s− p1 ) ( s−p 2) ( s− p3 ) …( s−p n)
are the zeroes, poles and gain respectively. Transfer function can also be represented
in time-domain where it is called the state-space representation of a system in matrix
form ẋ= Ax+ Bu and y=Cx + Du. A system can also be represented by its frequency
response in continuous form or at discrete points. There are several function in
MATLAB to generate LTI models. By using tf(NUM,DEN) will create a continuous time
transfer function given with the numerator and denominator coefficients, zpk(Z,P,K) will
create a continuous-time zero-pole-gain (ZPK) model system with zeroes vector Z, the
poles vector P and gain K, frd(RESPONSE,FREQS) function will create an frd model
system in which the output is a system in an frd model, and ss(A,B,C,D) function will
create a continuous-time state-space model system with matrices A,B,C,D and the
output system is an SS object. There are also functions for data retrieval. For example,
the tfdata(SYS,’v’) function will return the numerator and denominator coefficients of the
transfer function of the system, the zpkdata(SYS,’v’) will return the zeros, poles and
gain for the given transfer function of the system, the ssdata(SYS) will retrieve the
matrix data A,B,C,D for the state-space model of the system and the frdata(SYS) will
return the response data and frequency samples of the frequency response data but
take note that this function is only applicable only to FRD data. System conversion can
also be done to convert a certain system representation to another representation.
TF2SS() function converts transfer function to state-space representation, SS2TF()
function converts state-space representation to transfer function, TF2ZP() function
converts transfer function to zero-pole representation, ZP2TF() function converts zero-
pole representation to transfer function, ZP2SS() function converts zero-pole
representation to state-space representation and SS2ZP() function converts state-space
representation to zero-pole representation. Different systems can be connected in
series, parallel or in feedback connection. To connect systems in series, function
series(G1,G2) should be used where G1 and G2 are the parameters for two different
systems. To connect in parallel, the function parallel(G1, G2) should be used and to
connect systems in feedback connection, the function feedback(G1,G2,SIGN) should be
used where the parameter SIGN can be +1 for positive feedback and -1 for negative
feedback. By connecting systems, it simplifies and reduce the given block diagram and
it gets the overall transfer function for the whole system.

You might also like