Vous êtes sur la page 1sur 14

Azaan Azeem

2017-10-0088
Feedback and Control System Lab
27/01/2016

LAB 1
EXERCISE 1:
clc;clear all;close all
% Part 1
subplot(4,2,1);
num1 = [1 5 6];
den1 = [1 9 12];
y1 = tf(num1,den1);
step(y1);
% Part 2
subplot(4,2,2);
num2 = [0 2 0];
den2 = [1 8 15];
y2 = tf(num2,den2);
step(y2);
% Part 3
subplot(4,2,3);
num3 = poly([-2 -5 -5]);
den3 = poly([-1 2 -2]);
y3 = tf(2*num3,den3);
step(y3);
% Part 4
subplot(4,2,4);
num4 = [1 1 1];
den4 = poly([0 -1 -1]);
y4 = tf(2*num,den4);
step(y4);
% Part 5
subplot(4,2,5);
s = tf('s');
num5 = [3 9 12];
den51 = [1 2];
den52 = [1 5 11];
den5 = conv(den51,den52);
y5 = (3*(s^2) + 9*s + 12)/((s+2)*(s^2 + 5*s + 11));
step(y5);
% Part 6
subplot(4,2,6);
s = tf('s');
y6 = exp(-s)/(s^2);

step(y6);
% Part 7
subplot(4,2,7);
num7 = [];
den7 = [0 -2 16];
y7 = zpk(num7,den7,5);
step(y7);
% Part 8
subplot(4,2,8);
num8 = [0];
den8 = [-5-2j -5+2j -3];
y8 = zpk(num8,den8,6);
step(y8);
Figure Orders

PART
PART
PART
PART

1
3
5
7

PART
PART
PART
PART

2
4
6
8

EXERCISE 3:
clc; clear all;close all
num = {[1 6] ; 1};
den = {[1 4 4] ; [1 0 0]};
y = tf(num,den);
step(y);

EXERCISE 4:
clc; clear all;close all
num = {[0 6],[1 3] ; [1 0],[0 1]};
den = {[1 5],[1 5] ; [1 5],[1 5]};
y = tf(num,den);
step(y);

EXERCISE 5:

clc;clear all;close all


% Part 1
num1 = [1 5 6];
den1 = [1 9 12];
y1 = tf(num1,den1);
subplot(4,2,1);
pzmap(y1);
% Part 2
num2 = [0 2 0];
den2 = [1 8 15];
y2 = tf(num2,den2);
subplot(4,2,2);
pzmap(y2);
% Part 3
num3 = poly([-2 -5 -5]);
den3 = poly([-1 2 -2]);
y3 = tf(2*num3,den3);
subplot(4,2,3);
pzmap(y3);
% Part 4
num4 = [1 1 1];
den4 = poly([0 -1 -1]);
y4 = tf(2*num4,den4);
subplot(4,2,4);
pzmap(y4);

% Part 5
s = tf('s');
num5 = [3 9 12];
den51 = [1 2];
den52 = [1 5 11];
den5 = conv(den51,den52);
y5 = (3*(s^2) + 9*s + 12)/((s+2)*(s^2 + 5*s + 11));
subplot(4,2,5);
pzmap(y5);
% Part 6
s = tf('s');
y6 = exp(-s)/(s^2);
subplot(4,2,6);
pzmap(y6);
% Part 7
num7 = [];

den7 = [0 -2 16];
y7 = zpk(num7,den7,5);
subplot(4,2,7);
pzmap(y7);
% Part 8
j = sqrt(-1);
num8 = [0];
den8 = [-5-2j -5+2j -3];
y8 = zpk(num8,den8,6);
subplot(4,2,8);
pzmap(y8);
Figure Orders

PART
PART
PART
PART

1
3
5
7

PART
PART
PART
PART

2
4
6
8

EXERCISE 6:

clc;clear all;close all


% Part 1(original)
num1 = [1 5 6];
den1 = [1 9 12];
y1 = tf(num1,den1);
subplot(2,2,1);
pzmap(y1);
% Part 4(original)
num4 = [1 1 1];
den4 = poly([0 -1 -1]);
y4 = tf(2*num4,den4);
subplot(2,2,2);
pzmap(y4);
% Part 1(roots method)
num11 = roots(num1);
den11 = roots(den1);
y11 = zpk(num11,den11,1);
subplot(2,2,3);
pzmap(y11);
% Part 4(roots method)
num44 = roots(num4);
den44 = roots(den4);
y44 = zpk(num44,den44,2);
subplot(2,2,4);
pzmap(y44);

EXERCISE 7:

clc;clear all;close all


% Part 3(original)
num3 = poly([-2 -5 -5]);
den3 = poly([-1 2 -2]);
y3 = tf(2*num3,den3);
subplot(2,2,1);
pzmap(y3);
% Part 8(original)
j = sqrt(-1);
num8 = [0];
den8 = [-5-2j -5+2j -3];
y8 = zpk(num8,den8,6);
subplot(2,2,2);
pzmap(y8);
% Part 3(tf2zp method)
[z p k]= tf2zp(num3,den3);
y33 = zpk(z,p,k);
subplot(2,2,3);
pzmap(y33);
% Part 8(tf2zp method)
[z1 p1 k1]= tf2zp(poly(num8),poly(den8));
y88 = zpk(z1,p1,k1);
subplot(2,2,4);
pzmap(y88);

EXERCISE 8:

clc; clear all; close all;


% Part a
num1 = [0 3 -1];
den1 = [1 -3 2];
[r1,p1,k1] = residue(num1,den1);
() = 5 2 2
% Part b
num2 = [3 3 -1];
den2 = [1 -3 2];
[r2,p2,k2] = residue(num2,den2);
() = 17 2 5 + 3
% Part c
num3 = [7 2 3 -1];
den3 = [0 1 -3 2];
[r3,p3,k3] = residue(num3,den3);
() = 69 2 11 + 7 + 23
% Part d
num4 = [0 2 3 -1];

den4 = [1 -5 8 -4];
[r4,p4,k4] = residue(num4,den4);
() = 2 2 + 13 2 + 4
% Part e
num5 = [0 2 3 -1];
den5 = [1 -3 4 -2];
[r5,p5,k5] = residue(num5,den5);
() = (1 3.5) (1+) + (1 + 3.5) (1) + 4
% Part f
num6 = [0 0 1];
den6 = [1 0 4];
[r6,p6,k6] = residue(num6,den6);
() = 0.25 2 + 0.25 2
% Part g
num7 = [0 0 2 0 -1];
den7 = [1 0 2 0 1];
[r7,p7,k7] = residue(num7,den7);
() = 0.25 + 0.75 + 0.25 + 0.75

EXERCISE 9:

There are no 'k-terms of an equation if denominator has higher degree than


numerator.
Else number of 'k-terms is equal to (degree of Num. - degree of Den. + 1)

EXERCISE 11:

clc; clear all; close all;


s = tf('s');
% Part a
Y1 = (1/s);
subplot(5,2,1);
impulse(y1);
% Part b
Y2 = (1/(s-5));
subplot(5,2,2);
impulse(y2);
% Part c
Y3 = (1/(s-20));
subplot(5,2,3);
impulse(y3);
% Part d
Y4 = (1/(s+5));
subplot(5,2,4);
impulse(y4);
% Part e
Y5 = (1/(s+20));
subplot(5,2,5);
impulse(y5);
% Part f
Y6 = (1/(s^2 + 25));
subplot(5,2,6);
impulse(y6);
% Part g
Y7 = (1/(s^2 + 400));
subplot(5,2,7);
impulse(y7);
% Part h
Y8 = (1/(s^2 + 10*s + 50));
subplot(5,2,8);
impulse(y8);
% Part i
Y9 = (1/(s^2 - 10*s + 50));
subplot(5,2,9);
impulse(y9);

PART
PART
PART
PART
PART

A
C
E
G
I

EXERCISE 12:

clc; clear all; close all;


s = tf('s');
y1
y2
y3
y4
y5
y6
y7
y8
y9

=
=
=
=
=
=
=
=
=

(1/s);
(1/(s-5));
(1/(s-20));
(1/(s+5));
(1/(s+20));
(1/(s^2 + 25));
(1/(s^2 + 400));
(1/(s^2 + 10*s + 50));
(1/(s^2 - 10*s + 50));

PART
PART
PART
PART

B
D
F
H

hold on;
pzmap(y1);
pzmap(y2);
pzmap(y3);
pzmap(y4);
pzmap(y5);
pzmap(y6);
pzmap(y7);
pzmap(y8);
pzmap(y9);

EXERCISE 13:

clc; clear all; close all;


s = tf('s');
y = ((5*s^2 - 2*s + 23)/(s^2 + 6*s + 5));
subplot(2,1,1);
impulse(y);
subplot(2,1,2);
step(y);

Explanation:
Yes the shapes of the natural responses are indeed determined by the location
of poles and zeros and the response of the system changes abruptly at location
of poles and zeros it either becomes zero or it becomes unbounded.

EXERCISE 14:
numT = [0 1 2];
denT = [1 1 0];
sysT = tf(numT,denT);
t=0:0.01:5;
u=[zeros(1,200) 10*ones(1,10) zeros(1,100) -10*ones(1,10) zeros(1,181)];
y = lsim(sysT,u,t);
subplot(2,1,1);
plot(t,u);
subplot(2,1,2);
plot(t,y);

Explanation:
This code firstly creates a transfer function using numT and denT (numerator and denominator coefficients), then
time period is defined, and then input signal u is defined as a sort of small square pulses of magnitude 10 and 10 at two different points.
Next, the obtained system sysT is live simulated using the lsim command with input signals t and u and then
both the result and input signal u are plotted against t.

This code helps us to determine the live simulation results shown by a system when simulated under controlled
input signals.
The following plots are obtained of input signal u and results y against time, respectively;

Vous aimerez peut-être aussi