You are on page 1of 10

COMSATS-Lancaster Dual Degree

Programme

Names:-Ali Nawaz Ranjha


Registeration # DDP-FA10-BTE-008
Control Systems Lab

Lab Session 3:Q1.


(a) Obtain the impulse response of the following system
G(s )=1/s2+0.2s+1
(b) Obtain the step response of the following system
G(s )=s/s2+0.2s+1
(c) Explain why the results in (a) and (b) are same?
.

Q2. Design and simulate the RLC circuit given in last lab in M ATLAB with
the following input
Vi(t)=1/2 3/2cos(2t)
Q3. A system has a transfer function
X(s)/R(s)=2.5s+15 / 15s2+3s+15
Find the response of this system if the input is a ramp function with slop equal to 4.

Q1(ans.):(a)Impulse response:Output of system when input is


impulse. Writing our transfer function
W(s)=1/s2+0.2s+1
C(s)=Output of system
R(s)=Input of system

G(s)=C(s)/R(s)
C(s)=G(s) x R(s)
r(t)=delta(t)
R(s)=1
C(s)=G(s) x 1
Putting the value of G(s)
C(s)=1/s2+0.2s+1
We also know that
e-at sin(wt)= w /(s+a)2+w2 =>eq.(a)
adding and subtracting 0.01 in the above equation
C(s)=1/s2+0.2s+1+0.01-0.01
C(s)=1/s2+0.2s+0.01+1-0.01
C(s)=1/s2+2(s2)(0.1)+0.12+(0.99)
And (0.99)1/2=0.9949874371
So C(s) becomes
C(s)=1/(s+0.1)2+(0.9949874371)2
Multiplying and dividing our above equation with
0.9949874371
C(s)=(1.005037815) x
(0.9949874371/
2
2
(s+0.1) +(0.9949874371) )
Using the eq.(a)
c(t) =(1.005037815) x e-0.1t sin(0.9949874371t)
c(t) is our impulse response which is in time domain
Matlab code:%---------------------------% Question#1
%---------------------------% Using builtin command
num=[1]
den=[1 0.2 1]
LTIsys=tf(num,den)

subplot(2,1,1)
impulse(LTIsys)
grid on
% Using manual computation
t=0:0.01:60
y=(1.005037815).*(exp(-0.1.*t).*sin(0.9949874371.*t))
subplot(2,1,2)
plot(t,y)
xlabel('Time(seconds)')
ylabel('Amplitude')
title('Impulse Response using manual computation')
grid on

Results:Impulse Response
1

Amplitude

0.5
0
-0.5
-1

10

20

30

40

50

60

50

60

Time (seconds)

Impulse Response using manual computation


1

Amplitude

0.5
0
-0.5
-1

10

20

30
Time(seconds)

40

(a)Step response:Output of a system when input is a


step
Writing our transfer function
W(s)=s/s2+0.2s+1
C(s)=Output of system

R(s)=Input of system
G(s)=C(s)/R(s)
C(s)=G(s) x R(s)
r(t)=u(t)
R(s)=1/s
C(s)=G(s) x 1/s
Putting the value of G(s)
C(s)=(s/s2+0.2s+1) x (1/s)
C(s)=(1/s2+0.2s+1)
We also know that
e-at sin(wt)= w /(s+a)2+w2 =>eq.(a)
adding and subtracting 0.01 in the above equation
C(s)=1/s2+0.2s+1+0.01-0.01
C(s)=1/s2+0.2s+0.01+1-0.01
C(s)=1/s2+2(s2)(0.1)+0.12+(0.99)
And (0.99)1/2=0.9949874371
So C(s) becomes
C(s)=1/(s+0.1)2+(0.9949874371)2
Multiplying and dividing our above equation with
0.9949874371
C(s)=(1.005037815) x
(0.9949874371/
(s+0.1)2+(0.9949874371)2)
Using the eq.(a)
c(t) =(1.005037815) x e-0.1t sin(0.9949874371t)
c(t) is our step response which is in time domain
Matlab code:%---------------------------% Question#2
%---------------------------% Using builtin command
num=[0 1 0]
den=[1 0.2 1]

LTIsys=tf(num,den)
subplot(2,1,1)
step(LTIsys)
grid on
% Using manual computation
t=0:0.01:60
y=(1.005037815).*(exp(-0.1.*t).*sin(0.9949874371.*t))
subplot(2,1,2)
plot(t,y)
xlabel('Time(seconds)')
ylabel('Amplitude')
title('Step Response using manual computation')
grid on

Results:Step Response
1

Amplitude

0.5
0
-0.5
-1

10

20

30

40

50

60

50

60

Time (seconds)

Step Response using manual computation


1

Amplitude

0.5
0
-0.5
-1

10

20

30
Time(seconds)

40

Conclusion:As in our step response 1 pole gets cancelled


with 1 zero hence transfer function in both cases
become same so our results are same in case of
impulse as well as in case of step reponse.

Q2(ans.):-

Using impedence transfer method


ZC=1/sC
ZR=R
ZL=sL
Now applying voltage divider to obtain voltage
across the capacitor
eo(s) = ei(s) x (1/sC)/ sL+R+1/sC
simplifying the above equation yields
eo(s) = ei(s) / s2LC+sRC+1
G(s)= eo(s) / ei(s)
G(s)= 1 / s2LC+sRC+1
& ei(t)= -3/2cos(2t)
ei(s)=0.5s-1.5(s/s2+22)
eo(s) = 0.5s-1.5(s / s2+4) x (1 / s2LC+sRC+1)
for R=1 ohm
C=1 farad
L=1 henry

After solving partial fractions


eo(s) = 4.5 x (s/s2+4) + 3 (2 / s2+4) -1.5 -1.5 e-0.5t
+ 0.5 x (s+0.5) / (s+0.5)2+(sqrrt(3)/2)2)
-sqrrt(3)/6 x (sqrrt(3)/2) / (s+0.5)2+
(sqrrt(3)/2)2
now taking the inverse laplace transform yields
eo(t) = 4.5cos(2t) + 3sin(2t) - 1.5delta(t) - 1.5delta(t1)
+0.5e-0.5tcos((sqrrt(3)/2)t)
+sqrrt(3)/6 e-0.5tsin((sqrrt(3)/2)t)
Matlab code:%---------------------------% Question#2
%---------------------------t=0:0.01:120;
R=input('Enter the value of resisor in ohms=\n')
L=input('Enter the value of inductor in henry=\n')
C=input('Enter the value of resisor in farads=\n')
num=[1]
den=[L.*C R.*C 1]
LTIsys=tf(num,den)
e_in_t=0.5-1.5.*cos(2.*t)
lsim(LTIsys,e_in_t,t)
grid on

Results:-

Linear Simulation Results


2

1.5

Amplitude

0.5

-0.5

-1

20

40

60

80

100

120

Time (seconds)

Q3(ans.):Ramp with slope equal to 4


r(t)=4t u(t)
R(s)=4/s2
X(s)=R(s) x (2.5s+15/15s2+3s+15)
X(s)= 4/s2 x (2.5s+15/15s2+3s+15)
X(s)=10s+60/15s4+3s3+15s2
It is a 4rth order sdomain equation using Matlab to
solve the above equation yields
x(t)=4t - 2/15 + 2/15 e-0.1t cos((3xsqrr(11)/10) x t)
+0.2671167171 e-0.1t sin((3xsqrrt(11)/10) x t )
Matlab code:%---------------------------% Question#3
%----------------------------

t=0:0.01:120;
num=[0 0 0 10 60]
den=[15 3 15 0 0]
LTIsys=tf(num,den)
% When input is a ramp with slope 4
r_t=4.*t;
lsim(LTIsys,r_t,t)
grid on

Results:6

Linear Simulation Results

x 10

4.5
4
3.5

Amplitude

3
2.5
2
1.5
1
0.5
0

20

40

60
Time (seconds)

80

100

120

You might also like