Student Seminar Report & Project Report With Presentation (PPT,PDF,DOC,ZIP)

Full Version: LINEAR CONVOLUTION OF TWO FINITE LENGTH SEQUENCES USING DFT AND IDFT
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Procedure:-
1) Find the length of the first sequence x[n]=x_length
2) Find the length of the second sequence h[n]=h_length
3) Estimate the number of samples in the result of linear convolution of x[n] &h[n]=Y_length
4) If X_length <Y_length , pad enough number of zeros to x[n], so that the number of samples in the modified x[n]=Y_length
5) If h_length <Y_length ,pad enough number of zeros to h[n], so that the number of samples in the modified h[n]=Y_length
6) Take DFT for modified x[n]=x(k)
7) Take DFT for modified h[n]=H(k)
8) Compute Y(K)=X(K)*H(K)
9) Compute y(n)=IDFT(Y(k))
10) Verify if y[n]=conv(x,h)

MATLAB program for linear convolution using DFT and IDFT

Code:
clear
clc
close all
% FIRST SEQUENCE X1
x1 = [1 1 1 1];
nx1 = 0:length(x1)-1;
n1 = length(x1);
subplot(3,1,1);
stem(nx1,x1);
xlabel('n-->');
ylabel('x1-->');
title('First Sequence');
grid on;
% SECOND SEQUENCE X2
x2 = [1 1 1 1];
nx2 = 0:length(x2)-1;
n2 = length(x2);
subplot(3,1,2);
stem(nx2,x2);
xlabel('n-->');
ylabel('x2-->');
title('Second Sequence');
grid on;

N = n1+n2-1;
% IF N > length(x1) or length(x2) ZERO PAD
newx1 = [x1,zeros(1,N-n1)];
newx2 = [x2,zeros(1,N-n2)];

% TAKE DFT OF FIRST SEQUENCE
x1dft = fft(newx1);
% TAKE DFT OF SECOND SEQUENCE
x2dft = fft(newx2);

% MULTIPLY THE TWO DFTS
ydft = x1dft .* x2dft

% TAKE IDFT OF THE PRODUCT OF TWO DFTS
disp('Response obtained by DFTs')
y = ifft(ydft)
n = 0:length(y)-1;
subplot(3,1,3);
stem(n,y);
xlabel('n-->');
ylabel('x2-->');
title('Linearly convoluted Sequence');
grid on;

% VERIFICATION WITH DIRECT CONVOLUTION
disp('Response obtained by DFTs')
Ydirect = conv(x1,x2)

RESULT:- LINEAR CONVOLUTION USING DFT AND IDFT