DSP Lab 7
DSP Lab 7
Introduction:
If a discrete signal x(n) is periodic with a period of N. It means the signal satisfies the
following condition x(n) = x(n + kN) , where k is integer and N is the fundamental period of
the sequence. Then this signal can be expressed
1
as
N–1
2G kn
j
x(n) = ∑k=0 N......................... (A)
X(k)e N
where k = 0, ± 1 , ± 2 ,......... . The discrete Fourier series coefficients X(k) is itself a complex-
valued periodic sequence with fundamental period of N. Using WN=exp(-2n/ N), we express
equation (A) & (B) as-
nk............
X(k) = ∑N–1
n=0 x( n) W N (C)
..............
x(n) = 1 ∑N–1 X(k)W N -nk (D)
N k=0
Study the formulae of Discrete Fourier Series (DFS) and Discrete Fourier Transform from
Theory and methodology section.
Apparatus:
1. Computer (Desktop/Laptop)
2. MATLAB (at least version 6)
Precautions:
Make sure that all the m-files are saved in the current directory of MATLAB. Otherwise, the
m-files will not be found and executed when they are called from the command window
Experimental Procedure:
2.
L=5;
N=20;
n=[-N:N+1];
x1=[ones(1,L),
zeros(1,N-L+1)];
x=[x1 x1]
subplot(221)
stem(n,x)
title('Signal')
% find the DFS
with period N=20
and duty cycle
=5
k=[-N/2:N/2]
xn=[ones(1,L),
zeros(1,N-L)]
Xk=dfs(xn,N);
magXk=abs([Xk(
N/2+1:N)
Xk(1:N/2+1)])
subplot(222)
stem(k,magXk)
title('DFS with
N=20, L=5')
% find the DFS
with period N=50
and duty cycle=5
N=50;
L=5;
k=[-N/2:N/2]
xn=[ones(1,L),
zeros(1,N-L)]
Xk=dfs(xn,N);
magXk=abs([Xk(
N/2+1:N)
Xk(1:N/2+1)])
subplot(223)
stem(k,magXk)
title('DFS with
N=50, L=5')
% find the DFS
with period
N=100 and duty
cycle=5
N=200
L=5
k=[-N/2:N/2]
xn=[ones(1,L),
zeros(1,N-L)]
Xk=dfs(xn,N);
magXk=abs([Xk(
N/2+1:N)
Xk(1:N/2+1)])
subplot(224)
stem(k,magXk)
title('DFS with
N=200, L=5');
3.
w=0:pi/200:2*pi
H=1+exp(-j*w)
+exp(-j*2*w)
+exp(-j*3*w)
subplot(221)
plot(w,abs(H))
title('Magnitude
of DTFT of x(n)')
axis([0 6 0 4])
% computer the
4-point DFT
x=[1 1 1 1]
N=4
n=0:1:(N-1)
X4=dft(x,4)
subplot(222)
stem(n,abs(X4))
title('Magnitude
of 4-point DFT')
axis([0 3 0 4])
% compute the
16-point DFT
N=16
x=[ones(1,4)
zeros(1,12)] %
Note that x has
been zero
padded
n=0:1:(N-1)
X8=dft(x,N)
subplot(223)
stem(n,abs(X8))
hold on
plot(n,abs(X8),'-.k
')
title('Magnitude
of 16-point DFT')
axis([0 16 0 4])
% compute 32
point DFT
N=32
x=[ones(1,4)
zeros(1,28)] %
Note that x has
been zero
padded
n=0:1:(N-1)
X8=dft(x,N)
subplot(224)
stem(n,abs(X8))
hold on
plot(n,abs(X8),'-.k
')
title('Magnitude
of 32-point DFT')
axis([0 32 0 4])
1. Compare the results with your theoretical understanding and comment on the
findings.
2. Give the clear screen-shots where appropriate and describe what the figures might
mean theoretically.
3. Give the simulation codes at the end of the report.
Discussion and Conclusion:
Interpret the data/findings and determine the extent to which the experiment was successful
in complying with the goal that was initially set. Discuss any mistake you might have made
while conducting the investigation and describe ways the study could have been improved.
Reference(s):