Pages

Monday, December 13, 2010

MATLAB PROGRAM TO IMPLEMENT THE PROPERTIES OF DISCRETE FOURIER TRANSFORM (DFT) - CONVOLUTION PROPERTY


clear all;
x= input ('enter the first sequence');
h= input ('enter the second sequence');
No=input('number of samples?');
N1= length(x);
N2= length(h);
N=max(N1,N2);%length of sequence
x=[x zeros(1,N-N1)];  %modified first sequence
h=[h zeros(1,N-N2)];  %modified second sequence

for n=0:N-1;
    y(n+1)=0;
    for i=0:N-1
       j=mod(n-i,N);
       y(n+1)=y(n+1)+x(i+1)*h(j+1);  %shifting and adding
    end
end
n=0:1:No-1;
x4=fft(x);
x5=fft(h);
x6=fft(y);
%seq 2
subplot(121)
stem(n,x6);
title('dft of two convoluted signals');
x7=(x4).*(x5);%product of two dfts
subplot(122);
stem(n,x7);
title('product of two dfts');
grid on;
 
 
OUTPUT WAVEFORM 
 
 

1 comment:

  1. what kind of inputs should we get? what abt number of samples?
    Could you tell what inputs you gave for above graph?

    ReplyDelete