Sei sulla pagina 1di 10

DSP

LAB REPORT # 4
Submitted By:
Marryam Nawaz
SP-12-BET-043
Hifza Sajid
SP-12-BET-029
Submitted To:
Sir Mobeen Sabir
Class Instructor:
Sumayya Haroon
Class:
BET-5A
Dated:
07/03/2014
Task 01
n=0:10;
e=pi;
u=exp((i*e)/3)
x=(.5*u).^n;
subplot(2,2,1)
plot(n,x);
xlabel('time')
ylabel('input')
b=fft(x);
subplot(2,2,2)
plot(n,b);
xlabel('time')
ylabel('fft')
w=0:2*pi;
t=exp(i*w)./(exp(i*w)-(.5*u));
subplot(2,2,3)
plot(w,abs(t));
xlabel('time')
ylabel('magnitude')
subplot(2,2,4)
plot(w,angle(t));
xlabel('time')
ylabel('angle')

OUTPUT:
1 2

0.5 1.5
input

fft
0 1

-0.5 0.5
0 5 10 0 5 10
time time

2 1

0.5
magnitude

1.5
angle

0
1
-0.5

0.5 -1
0 2 4 6 0 2 4 6
time time

Task 02
n=0:20;
w=0:2*pi;
t=exp(i*w)./(exp(i*w)-(.5));
subplot(2,1,1)
plot(w,abs(t));
xlabel('time')
ylabel('magnitude')
subplot(2,1,2)
plot(w,angle(t));
xlabel('time')
ylabel('angle')

OUTPUT:
2
magnitude

1.5

0.5
0 1 2 3 4 5 6
time

0.5
angle

-0.5

-1
0 1 2 3 4 5 6
time

Task 03
n=0:7;
x= [4 3 2 1 1 2 3 4];
subplot(3,1,1)
stem(n,x)
xlabel('time')
ylabel('input')
s=fft(x)
subplot(3,1,2)
plot(n,abs(s))
xlabel('time')
ylabel('magnitude')
subplot(3,1,3)
plot(n,angle(s))
xlabel('time')
ylabel('angle')

OUTPUT:
input 4

0
0 1 2 3 4 5 6 7
time
20
magnitude

10

0
0 1 2 3 4 5 6 7
time
2
angle

-2
0 1 2 3 4 5 6 7
time

Task 04
n1=2:20;
x1=2.*(0.8).^n+2;
b=fft(x);
w=0:2*pi;
t1=(1.024)./(exp(2*i*w)-(.8))
title('part(a)')
subplot(3,2,1)
plot(w,abs(t1));

xlabel('time')
ylabel('magnitude')
subplot(3,2,2)
plot(w,angle(t1));

xlabel('time')
ylabel('angle')
n2=0:20;
x2=2.18;
t2=(2.18)./(1-exp(i*w));
title('part(b)')
subplot(3,2,3)
plot(w,abs(t2));

xlabel('time')
ylabel('magnitude')
subplot(3,2,4)
plot(w,angle(t2));

xlabel('time')
ylabel('angle')
t3=-(1.42)./(exp(2*i*w)+0.7)
title('part(c)')
subplot(3,2,5)
plot(w,abs(t3));

xlabel('time')
ylabel('magnitude')
subplot(3,2,6)
plot(w,angle(t3));

xlabel('time')
ylabel('angle')

OUTPUT:
part(b)
10 5
magnitude

angle
5 0

0 -5
0 2 4 6 0 2 4 6
time time
part(c)
10 2
magnitude

angle
5 0

0 -2
0 2 4 6 0 2 4 6
time time

4 5
magnitude

angle

2 0

0 -5
0 2 4 6 0 2 4 6
time time

n=0:30;

x=(5*(-0.9).^n).*cos(0.1*pi.*n)
subplot(3,1,1)
stem(n,x),grid on
X=abs(fft(x));
subplot(3,1,2)
plot(X),grid on
title(' Magnitude of Discrete time fourier transform')
subplot(3,1,3)
plot(angle(X)),grid on
title(' Angle of Discrete time fourier transform')

OUTPUT:
5

-5
0 5 10 15 20 25 30
Magnitude of Discrete time fourier transform
40

20

0
0 5 10 15 20 25 30 35
Angle of Discrete time fourier transform
1

-1
0 5 10 15 20 25 30 35

Task 05
w=0:2*pi;
y=(2+exp(-i*w))./(1+0.25*exp(-i*w)-0.25*exp(-i*w*2));
subplot(2,1,1)
plot(w,abs(y))
xlabel('frequency')
ylabel('magnitude')
subplot(2,1,2)
plot(w,angle(y))
xlabel('frequency')
ylabel('angle')
3
magnitude

2.5

1.5
0 1 2 3 4 5 6
frequency

0.4

0.2
angle

-0.2

-0.4
0 1 2 3 4 5 6
frequency

Part(b)
w=0:2*pi;
y=4-8./(exp(-i*w*2)+2*exp(-i*w)+4);
subplot(2,1,1)
plot(w,abs(y))
xlabel('frequency')
ylabel('magnitude')
subplot(2,1,2)
plot(w,angle(y))
xlabel('frequency')
ylabel('angle')
3

2.5
magnitude

1.5

1
0 1 2 3 4 5 6
frequency

0.5
angle

-0.5

-1
0 1 2 3 4 5 6
frequency

Potrebbero piacerti anche