Exp 5
Exp 5
Submitted by Submitted to
Objectives:
Theory:
The DFT is one of the most powerful tools in digital signal processing which enables us to
find the spectrum of a finite-duration signal.
The standard equations which define how the Discrete Fourier Transform and the Inverse
convert a signal from the time domain to the frequency domain and vice versa are as
follows:
𝑗2𝜋𝑘𝑛
−
DFT: 𝑋(𝐾) = ∑𝑁−1
𝑛=0 𝑥 (𝑛)𝑒 𝑁 for k=0, 1, 2….., N-1
𝑗2𝜋𝑘𝑛
IDFT: 𝑥 (𝑛) = ∑𝑁−1
𝑘=0 𝑋 (𝐾 )𝑒 𝑁 for n=0, 1, 2….., N-1
In divide and conquer approach the input sequence is mapped into two-dimensional array.
The main focus of this approach is to reduce computational complexity for this reason the
whole problem is divided into few subproblems and then solved the problems and then
recombined the result. If N input elements then number of row and column will be L, M.
where, N=LM
0 1 ------------ M-1
0 x(0,0) x(0,1) ----------- x(0,M-1)
1 x(1,0) x(1,1) ------------ x(1,M-1)
----- --------- --------- ----------- ----------
L-1 x(L-1,0) x(L-1,1) ----------- x(L-1,M-1)
Algorithm:
for i=1:5
for j=1:3
g(i,j)=f(i,j)*power(pp,(i-1)*(j-1));
end
end
for i=1:5
s=0;
for j=1:3
for o=1:5
s=s+g(o,j)*power(pl,(o-1)*(i-1));
end
X(i,j)=s;
s=0;
end
end
X
% Plot amplitude spectrum
n=0:14;
z=X(:);
amplitude_spectrum=abs(z);
Phase_spectrum=angle(z);
figure;
subplot(2, 1, 1); % Create a subplot with 2 rows and 1 column,
first plot
stem(n, amplitude_spectrum, 'filled'); % Discrete plot
title('Amplitude Spectrum');
xlabel('Frequency index');
ylabel('Amplitude');
grid on;
% Plot phase spectrum
subplot(2, 1, 2); % Second plot
stem(n, Phase_spectrum, 'filled'); % Discrete plot
title('Phase Spectrum');
xlabel('Frequency index');
ylabel('Phase (radians)');
grid on;
Input:
Output:
X=
Discussion and conclusion: In this experiment, to compute the DFTs of a sequence divide
and conquer algorithm is used. It is a very efficient algorithm. 15 points DFT calculated in
this experiment where complex multiplication needed 135 and complex addition needed
90, so total computation is 225. But direct DFT used then complex multiplication need 225
and addition need 210 so total computation need 435. So in divide and conquer approach
computation saved (435-225)=210.