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

Lab#7 Block Diagram Reduction and Analysis and

Design of Feedback Systems

Pre Lab Tasks


Task 1

Implement the following example in MATLAB

Given SISO LTI models C and G, you can construct the closed-loop transfer T from r to y using
CONNECT function.

e
+ u
r --->O-->[ C ]---[ G ]-+---> y
- | |
+<--------------------+

C.InputName = 'e'; C.OutputName = 'u';


G.InputName = 'u'; G.OutputName = 'y';
Sum = sumblk('e','r','y','+-');
T = CONNECT (G,C,Sum,'r','y')

MATLAB Code

clc
clear all
close all
c.inputname= ‘e’;
c.outpuname=‘u’;
g. inputname= ‘u’;
g.outname= ‘y’;
x =sumblk(‘e’, ‘r’, ‘y’, ‘+-’);
T=connect(g,c,sum, ‘r’, ‘y’);

Results
Lab Tasks

Lab Task 1:

For the following Figures find the transfer function (C/R) using series, parallel and feedback
functions and plot unit step response for the system. Verify the results using Simulink.

i.

Figure. 7.1 Series block diagram reduction

MATLAB Code

%Define G1(s), G2(s), G3(s), R(s)


num = [1];
den1 = [1 1];
den2 = [1 1];
den3 = [1 1];
G1 = tf(num,den1); %making transfer fuctions for G1(s)
G2 = tf(num,den2); %making transfer fuctions for G2(s)
G3 = tf(num,den3); %making transfer fuctions for G3(s)
S_out = series(G1,G2);
S_output = series(S_out,G3);
step(S_output);

Results
SIMULINK
ii.

Figure. 7.2 Parallel block diagram reduction

MATLAB Code

%Define G1(s), G2(s), G3(s), R(s)


num = [1];
den1 = [1 1];
den2 = [1 1];
den3 = [1 1];
G1 = tf(num,den1); %making transfer fuctions for G1(s)
G2 = tf(num,den2); %making transfer fuctions for G2(s)
G3 = tf(num,den3); %making transfer fuctions for G3(s)

P_out = parallel(G1,G2);
P_output = parallel(P_out,G3);
step(P_output)

Results
SIMULINK
iii.
Figure. 7.3 Feedback block diagram reduction

MATLAB Code

%Define G1(s), G2(s), G3(s), R(s)


num = [1];
den1 = [1 1];
den2 = [1 1];
den3 = [1 1];
G1 = tf(num,den1); %making transfer fuctions for G1(s)
G2 = tf(num,den2); %making transfer fuctions for G2(s)
G3 = tf(num,den3); %making transfer fuctions for G3(s)

H1 = tf([1],[1 2]);
H2 = tf([1],[1 3]);
F1 = series(H1,H2);
F2 = series(G2,G3);
Feed_out = feedback(F1,F2,+1);
Feed_output = series(G1,Feed_out);
step(Feed_output)

Results
Lab Task 2:

Using connect functions find the equivalent transfer function for block diagram in Figure 7.4 and
Figure 7.5. Plot the unit step response and verify using Simulink.

Gi(s)=1/(s+1)

i.
Figure. 7.4 Block diagram reduction Task 2

MATLAB Code

Gs1 = tf([1],[1 1]);


Gs2 = tf([1],[1 2]);
Gs3 = tf([1],[1 3]);
Gs4 = tf([1],[1 4]);
Gs5 = tf([1],[1 5]);
Gs6 = tf([1],[1 6]);
Gs7 = tf([1],[1 7]);

Gs1.inputname='i';
Gs1.outputname='j';
Gs2.inputname='a';
Gs2.outputname='b';
Gs3.inputname='a';
Gs3.outputname='d';
Gs4.inputname='a';
Gs4.outputname='e';
Gs5.inputname='i';
Gs5.outputname='h';
Gs6.inputname='k';
Gs6.outputname='c';
Gs7.inputname='c';
Gs7.outputname='l';

s1=sumblk('a','l','r','j','-+-');
s2=sumblk('i','b','d','++');
s3=sumblk('f','e','d','++');
s4=sumblk('k','h','c','f','+-+');

s_1=CONNECT(Gs1,Gs2,Gs3,Gs4,Gs5,Gs6,Gs7,s1,s2,s3,s4,'r','c')
t=0:0.1:10;
x=ones(1,length(t));
v=lsim(s_1,x,t);
plot(t,v)
xlabel('Time')
ylabel('Amplitude')
title('Step Response')

RESULTS

SIMULINK
ii.

Figure. 7.5 Block diagram reduction Task 2

MATLAB Code

Gs1 = tf([1],[1 1]);


Gs2 = tf([1],[1 2]);
Gs3 = tf([1],[1 3]);
Gs4 = tf([1],[1 4]);
Gs5 = tf([1],[1 5]);
Gs6 = tf([1],[1 6]);
Gs7 = tf([1],[1 7]);
Gs8 = tf([1],[1 8]);
Gs1.inputname='e';
Gs1.outputname='k';
Gs2.inputname='l';
Gs2.outputname='o';
Gs3.inputname='l';
Gs3.outputname='f';
Gs4.inputname='l';
Gs4.outputname='d';
Gs5.inputname='i';
Gs5.outputname='b';
Gs6.inputname='c';
Gs6.outputname='h';
Gs7.inputname='i';
Gs7.outputname='c';
Gs8.inputname='c';
Gs8.outputname='j';

s1=sumblk('e','r','a','+-');
s2=sumblk('a','o','b','++');
s3=sumblk('l','j','k','++');
s4=sumblk('g','f','d','++');
s5=sumblk('i','h','g','-+');
OUT=CONNECT(Gs1,Gs2,Gs3,Gs4,Gs5,Gs6,Gs7,Gs8,s1,s2,s3,s4,s5,'r','c');
t=0:0.1:10;
x=ones(1,length(t));
output=lsim(OUT,x,t);
plot(t,output)
xlabel('Time')
ylabel('Amplitude')
title('Step Response')

RESULTS

SIMULINK
Post Lab Tasks

Lab Task No 1:

For the following system consider: Plant=Motor=1/[s(s+6)] and controller=k, design a closed
loop system with poles at –3±3j. Compare the motor system response before and after
implementation of controller
Figure. 7.6 System for Task 3

– a −a a2
Hint: According to the feedback analysis, to get poles at ± j, we need to set K =
2 2 2

Calculation and MATLAB Code

From the given fact Plant=Motor=1/[s(s+6)] and controller=k

We get that a=6

So

K=a2/2 = 6^2 / 2 = 36 / 2 = 18

K = 18

Performance Viva
Total/15
(10 Marks) (5 Marks )
Performance /6

Results /3

Critical Analysis /1
Comments
Critical Analysis / Conclusion
In this lab we have learnt how to reduce block diagrams using MATLAB functions and plot
the result and verification of the results using Simulink also how to design controller system
gain for obtaining specified poles.

You might also like