Experiment 22

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

Experiment 22

Object: Finite Causal sequence of infinite duration


x(n) = an (u(n)-u(n-L))
Using 32 point DFT Show the effect of (n-L) zero padding of frequency resolution
i.
ii.
iii.

L=N
L=N/2
L=N/4

Software Used: MATLAB

Theory: In general, the equally spaced frequency samples X(2k/N), k=0,1.N-1, do not uniquely represent the
original sequence x(n) when x(n) has infinite duration. Instead, the frequency samples X(2 k/N), k=0,1.N1, corresponds to a periodic sequence xp(n) of period N, where xp(n) is an aliased version of x(n)

When the sequence x(n) has a finite duration of length L<=N, then xp(n) is simply periodic repetition of x(n)

Consequently the frequency samples X(2k/N), k=0,1.N-1, uniquely represent the finite duration sequence
x(n). Since x(n) is equivalent to xp(n) over a single period(padded by N-L zeros) the original finite duration
sequence x(n) can be obtained.
Zero padding does not provide any additional information about the spectrum X(w) of the sequence x(n),
however computing N point DFT results in a better display of the fourier transform.

Source Code:75

clc;
clear all;
close all;
a=0.9;
N=32;
L=N;
l=0:L-1;
c=0;
for i=1:length(l)
y(i)=a^c;
c=c+1;
end;
x=[y zeros(1,N-L)];
subplot(3,2,1);
stem(0:length(x)-1,x);
xlabel('<----n---->');
ylabel('<---x(n)=a^n[u(n)-u(n-L)]--->');
title('Input Signal with length L=N and (N-L) zero padding');
X=fft(x,N);
subplot(3,2,2);
stem(0:length(X)-1,X);
hold on;
plot(0:length(X)-1,X);
xlabel('<----k---->');
ylabel('<---X(k)--->');
title('N-point DFT; N=32');
L=N/2;
l=0:L-1;
c=0;
for i=1:length(l)
z(i)=a^c;
c=c+1;
end;
x=[z zeros(1,N-L)]
subplot(3,2,3);
stem(0:length(x)-1,x);
xlabel('<----n---->');
ylabel('<---x(n)=a^n[u(n)-u(n-L)]--->');
title('Input Signal with length L=N/2 and (N-L) zero padding');
76

X=fft(x,N);
subplot(3,2,4);
stem(0:length(X)-1,X);
hold on;
plot(0:length(X)-1,X);
xlabel('<----k---->');
ylabel('<---X(k)--->');
title('N-point DFT; N=32');
L=N/4;
l=0:L-1;
c=0;
for i=1:length(l)
f(i)=a^c;
c=c+1;
end;
x=[f zeros(1,N-L)];
subplot(3,2,5);
stem(0:length(x)-1,x);
xlabel('<----n---->');
ylabel('<---x(n)=a^n[u(n)-u(n-L)]--->');
title('Input Signal with length L=N/4 and (N-L) zero padding');
X=fft(x,N);
subplot(3,2,6);
stem(0:length(X)-1,X);
hold on;
plot(0:length(X)-1,X);
xlabel('<----k---->');
ylabel('<---X(k)--->');
title('N-point DFT; N=32');

Results:

77

Conclusion: For the given input sequence, N-L Zero padding does not provide any additional information
about the spectrum X(w) of the sequence x(n), however computing N point DFT results in a better display of
the fourier transform..

78

You might also like