Lab Report 6
Lab Report 6
LAB # 06
Registration FA19-BEE-141
Numbers FA19-BEE-223
Class BEE-5D
Lab Assessment
Post Lab Total
Pre- In-
Data Data Writing
Lab Lab
Presentation Analysis Style
SERIES:
>>sys = SERIES(sys1,sys2)
Series connects two LTI models in series. This function accepts any type of LTI model. The two
systems must be either both continuous or both discrete with identical sample time. Static gains are
neutral and can be specified as regular matrices.
PARALLEL:
>>sys = parallel(sys1,sys2)
Parallel connects two LTI models in parallel. This function accepts any type of LTI model. The two
systems must be either both continuous or both discrete with identical sample time. Static gains are
neutral and can be specified as regular matrices.
FEEDBACK:
>>sys = FEEDBACK(sys1,sys2,±1
Feedback connects two systems in feedback order, where sys1 is the forward path gain, sys2 is the
feedback path gain and ±1 specifies positive and negative feedback respectively.
CONNECT: Used for block-diagram interconnections of LTI models.
Name-based interconnection:
In this approach, you name the input and output signals of all LTI blocks SYS1, SYS2, in the block
diagram, including the summation blocks. The aggregate model SYS is then built by
SYS = CONNECT(SYS1,SYS2,...,INPUTS,OUTPUTS)
Code:
C=tf([1],[1 1]);
G=tf([1],[1 1]);
C.InputName = 'e'; C.OutputName = 'u';
G.InputName = 'u'; G.OutputName = 'y';
Sum = sumblk('e','r','y','+-');
T = connect(G,C,Sum,'r','y')
step(T)
In this task, I simply implemented the code given in the prelab to understand the syntax and the way
block diagram is written via MATLAB code. And I use step as input.
CODE:
sys1= tf([1],[1 1])
sys2= tf([1],[1 1])
sys3= tf([1],[1 1])
OutputA= series(sys2,sys3)
Output= series(sys1,OutputA)
step(Output)
Graph:
Simulink:
Figure shows the step response obtained from simulink of transfer functions in series
In this task, a series block diagram is implemented via a MATLAB code and output is verified by
implementing the same block diagram in SIMULINK.
Graph:
In this task, parallel blocks are implemented in MATLAB and results are verified through
SIMULINK.
Graph:
Figure shows the step response of transfer functions using feedback function
Figure shows the block diagram in simulink of transfer functions using feedback function
Figure shows the step response we got from Simulink of TFs with feedback function
In this task, a feedback system is implemented in MATLAB by using the command feedback.
Results are verified using SIMULINK.
Graph:
Figure shows the step response of block diagram in (i) obtained via simulink
Task-2:
Code:
g1=tf([1],[1 1]);
g2=tf([1],[1 1]);
g3=tf([1],[1 1]);
g4=tf([1],[1 1]);
g5=tf([1],[1 1]);
g6=tf([1],[1 1]);
g7=tf([1],[1 1]);
g8=tf([1],[1 1]);
g1.outputname='b';g1.inputname='a';
g2.outputname='i';g2.inputname='c';
g3.outputname='g';g3.inputname='c';
g4.outputname='k';g4.inputname='c';
g5.outputname='m';g5.inputname='l';
g6.outputname='f';g6.inputname='e';
Graph:
Simulink:
Figure shows the step response of block diagram in (i) obtained via simulink
Calculation:
From the given fact Plant=Motor=1/[s(s+6)] and controller=k
We get that a=6 So
K=a^2/2 = 6^2 / 2 = 36 / 2 = 18
K = 18
Task-1:
Code (with controller):
num=[0 0 1];
den=[1 6 0];
plant=tf(num,den)
num=[18];
den=[1];
k=tf(num,den)
k.outputname='u';k.inputname='e';
plant.outputname='y';plant.inputname='u';
GRAPH:
Graph:
num=[0 0 1];
den=[1 6 0];
plant=tf(num,den)
plant.outputname='y';plant.inputname='u';
sum=sumblk('u','y','r','-+')
T=connect(plant,sum,'r','y');
step(T)
GRAPH:
Graph: