Linear Convolution of Two Sequences Using DFT and IDFT
Linear Convolution of Two Sequences Using DFT and IDFT
Linear Convolution Of Two Sequences using DFT and IDFT clc; clear all; x=input('Input First Sequence'); h=input('Input Second Sequence'); n1=length(x); n2=length(h); N=n1+n2-1; x1=[x zeros(1,N-n1)]; x2=[h zeros(1,N-n2)]; a=fft(x, N); b=fft(h, N); c=a.*b; d=ifft(c, N); disp('First Sequence'); x disp('Second Sequence'); h disp('Convolved Sequence'); d n=0:N-1; subplot(3,1,1); stem(x); title('First Sequence'); ylabel('Signal'); xlabel('Time'); subplot(3,1,2); stem(h); title('Second Sequence'); ylabel('Signal'); xlabel('Time'); subplot(3,1,3); stem(d); title('Convolved Sequence'); ylabel('Signal'); xlabel('Time');
3.0000
4.0000
3.0000
2.0000
1.0000
Signal
First Sequence
Signal
3.5
3.5
Signal
2 0 1 2 3 4 Time 5 6 7