XT e E: 1. (A) and (B)

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

1.

(a) and (b)


2 t 2 t
j j
x t e 16
e 8

MAIN program:
syms t

x=exp(i*2*pi*t/16)+exp(i*2*pi*t/8);
xr=real(x);
subplot(2,1,1)
ezplot(xr,[0 32])
title('real part')
xi=imag(x);
subplot(2,1,2)
ezplot(xi,[0 32])
title('imaginary part')

Function:
function xr=sreal(x);
xr=real(x)

function xi=simag(x)
imag(x)

Note: save all functions in separate MATLAB file and save corresponding their file name
(default).

MATLAB output after executing main program:

Fundamental period is 32.


(c)

MAIN program:
t=0:1:32;
x=exp(i*2*pi*t/16)+exp(i*2*pi*t/8);
xm=sabs(x);
subplot(2,1,1)
plot(t,xm)
title('magnitude')
xa=sangle(x);
subplot(2,1,2)
plot(t,xa)
title('angle')

Functions:
function xm=sabs(x)
xm=abs(x);

function xa=sangle(x)
xa=angle(x);

Output:

(d)

The value of n to get 5 full cycles is: 5000.


The value of k to complete 5 cycles is: 25.

MATLAB program:
n=0:1:5000;
f=5;
k=0:0.01:25;
f0=5000;
x=sin(2*pi*f*n/f0);
subplot(2,1,1)
plot(n,x)
title('plot of x(n)')
xlabel('n')
ylabel('x(n)')

title('plot of x(n)')
xs=sin(2*pi*k/5);

subplot(2,1,2)
plot(k,xs)
title('plot of x_s(k)')
xlabel('k')
ylabel('x_s(k)')

MATLAB output:

2.
(a)
The difference equation is,
Y z 1
H z
X z 2 3L
Y z 2 3L X z
2Y z 3LY z X z
2 y n 3 y n 1 x n
(b)
2 y n 3 y n 1 x n

Take z transform.
2Y z 3 zY z X z
2 3z Y z X z
Y z 1

X z 2 3z

Step response:
Code:
n=1;
d=[-3 2];
s=tf(n,d,1)
step(s)

Output:

(c)
MATLAB program to find poles:
n=1;
d=[-3 2];
s=tf(n,d,1);
[zeros poles k]=tf2zp(n,d)

MATLAB output:
zeros =
Empty matrix: 0-by-1
poles =
0.6667
k =
-0.3333
(d)
Y z 1

X z 2 3z
1

z 2 z 1 3
R

2R 3
(e)
n
1
h2 n
2
z
H2 z
1
z
2

(f)
Find poles:
1
z 0
2
1
z
2

MATLAB program:
n=[1 0];
d=[1 -1/2];
s=tf(n,d,1);
[zeros poles k]=tf2zp(n,d)

Output:
zeros =
0
poles =
0.5000
k =
1

(g)
Series expansion,
z
H2 z
1
z
2
1

1
1 1
2z
1
Y2 z X 2 z 1 1
2z

3.
(a)
1 p
F s e st f t dt
1 e ps 0

Write the Laplace transform of f(t) in terms of integrals.



F s f t e st dt
0
p
f t e st dt f t e st dt
0 p

(2)
The second integral is represented by,

e st f t dt e st f t p dt
p p

Apply substitution method.


t p
t p
d dt

e st f t dt e s p f d
p p

e sp f e s d
0

e sp
F s

Substitute this expression in equation (2)


p
F s f t e st dt e sp F s
0

1 e F s f t e
p
sp st
dt
0

1 p
F s f t e
st
dt
1 e ps 0

Hence the property is proved.

(b)
1
L v t e st sin t dt
1 e s 0


1 e s sin t cos t
st


1 e s s2 1 0


1 e s
s sin cos e0s s sin 0 cos 0

1 e s s2 1 s2 1
1 e 1 s

1 e s s 2 1
1 1
for s 0
1 e s s 2 1

(c)
0.06 K s 0.2
H s
s 0.6 s 2 0.08s 0.06 K
3

MATLAB program:
K1=0.02;
n1=conv([0.06.*K1],[1 0.2]);
d1=[1 0.6 0.08 0.06*K1];
s1=tf(n1,d1);
subplot(2,2,1)
step(s1)
title('K1=0.02');
K2=0.04;
n2=conv([0.06.*K2],[1 0.2]);
d2=[1 0.6 0.08 0.06*K2];
s2=tf(n2,d2);
subplot(2,2,2)
step(s2)
title('K2=0.04');
K3=0.08;
n3=conv([0.06.*K3],[1 0.2]);
d3=[1 0.6 0.08 0.06*K3];
s3=tf(n3,d3);
subplot(2,2,3)
step(s3)
title('K=0.08');
K4=0.16;
n4=conv([0.06.*K4],[1 0.2]);
d4=[1 0.6 0.08 0.06*K4];
s4=tf(n4,d4);
subplot(2,2,4)
step(s4)
title('K=0.16');

MATLAB OUTPUT

4.
d2y dy
2
3 2y u t
dt dt
Take Laplace transform on both sides.
s 2Y s 3sY s 2Y s U s
s 2 3s 2 Y s U s
Y s 1

U s s 3s 2
2

Apply bilinear transform.


Y s 1
2
U s s 3s 2
1

s 1 s 2 s
2 z 1
T z 1

Y z 1

U z 2 z 1 2 z 1
1 2
T z 1 T z 1
z 1
2


2 2
z 1 z 1 z 1 2 z 2
T T
T 2 z 1
2


2 z 1 Tz T 2 z 1 2Tz 2T
T 2 z 1
2


2 T z T 2 2 2T z 2T 2
T 2 z 1
2


2 2 T z T 2 1 T z T 1

(a)
Find poles by taking denominator equal to zero.
2 2 T z T 2 1 T z T 1 0
2 T z T 2 1 T z T 1 0
1 T z T 1 0, 2 T z T 2 0
T 1 T 2
z , z
1 T 2 T
1 T 2 T
z , z
1 T 2 T

(b)
Find complementary function.
k k
1 T 2 T
CF
1 T 2 T
PI 0

y k CF PI
k k
1 T 2 T
0
1 T 2 T
k k
1 T 2 T

1 T 2 T

(c)
k k
1 T 2 T 1
y k
1 T 2 T 2
. (0)
k 0
Substitute .
0 0
1 T 2 T 1
y 0
1 T 2 T 2
1
0
2
1

2
... (1)
k 1
Substitute .
1 1
1 T 2 T 1
y 1
1 T 2 T 2
1 T 2 T 1
0
1 T 2 T 2
1 T 2 T 1

1 T 2 T 2
(2)

Solve equations (1) and (2).


1
1 T
2
1
2 T
2

Substitute computed values in equation (0).


k k
1 1 T 1 2 T 1
y k 1T 2 T
2 1 T 2 2 T 2
1
k k
1 T 2 T
1 T 2 T 1
2 1 T 2 T

(d)
MATLAB program:
k=0:1:25;
T1=1;
y1=(1/2).*(((1-T1).*((1-T1)./(1+T1)).^k)-((2-T1).*((2-T1)./(2+T1)).^k)+1);
T2=0.5;
y2=(1/2).*(((1-T2).*((1-T2)./(1+T2)).^k)-((2-T2).*((2-T2)./(2+T2)).^k)+1);
T3=0.1;
y3=(1/2).*(((1-T3).*((1-T3)./(1+T3)).^k)-((2-T3).*((2-T3)./(2+T3)).^k)+1);
T4=0.01;
y4=(1/2).*(((1-T4).*((1-T4)./(1+T4)).^k)-((2-T4).*((2-T4)./(2+T4)).^k)+1);
plot(k,y1,k,y2,k,y3,k,y4);
legend('T=1','T=0.5','T=0.1','T=0.01')
xlabel('k')
ylabel('y(k)')

Output:

5.

MATLAB code:
Wp = 100/750; %assume sampling frequency is 1500 hz
Ws =500/750;
disp('buttor worth filter');
[filter_order,wn] = buttord(Wp,Ws,-0.5,-30)
[zeros1,poles1,k1]=butter(filter_order,wn)
s1=zpk(zeros1,poles1,k1);
bode(s1)
Output:

6.
MATLAB program:

n=1;
d=conv([1 1],[1 1 1]);
fs=2;
[numd,dend] = bilinear(n,d,fs);
disp('Thus the filter coefficients are:')
numd
dend
s=tf(numd,dend,1)
pzmap(s)
bode(s)

MATLAB output:
Thus the filter coefficients are:
numd =
0.0095 0.0286 0.0286 0.0095

dend =
1.0000 -2.0286 1.4762 -0.3714

Transfer function:
0.009524 z^3 + 0.02857 z^2 + 0.02857 z + 0.009524
-------------------------------------------------
z^3 - 2.029 z^2 + 1.476 z - 0.3714

Sampling time: 1

7)
MATLAB program:
For low pass filter design.
Wp = 500/4000;
Ws =3000/4000;
disp('butterworth filter');
[filter_order,wn] = buttord(Wp,Ws,3,20)
[zeros1,poles1,k1]=butter(filter_order,wn)
s1=zpk(zeros1,poles1,k1);
bode(s1)
hold on
disp('chebyshev type 2 filter');
[zeros2,poles2,k2]=cheby2(filter_order,20,Ws)
s2=zpk(zeros2,poles2,k2);
bode(s2)
hold on
disp('chebyshev type 1 filter');
[zeros3,poles3,k3]=cheby1(filter_order,20,Ws)
s3=zpk(zeros3,poles3,k3);
bode(s3)

output:
For high pass filter design.

Wp = 500/4000;
Ws =3000/4000;
disp('buttor worth filter');
[filter_order,wn] = buttord(Wp,Ws,3,20)
[zeros1,poles1,k1]=butter(filter_order,wn)
s1=zpk(zeros1,poles1,k1);
bode(s1)
hold on
disp('chebyshev type 2 filter');
[zeros2,poles2,k2]=cheby2(filter_order,20,Ws,'high')
s2=zpk(zeros2,poles2,k2);
bode(s2)
hold on
disp('chebyshev type 1 filter');
[zeros3,poles3,k3]=cheby1(filter_order,20,Ws,'high')
s3=zpk(zeros3,poles3,k3);
bode(s3)

output:

You might also like