Thursday, September 15, 2011

CIRCULAR CONVOLUTION


2. CIRCULAR CONVOLUTION



AIM: To verify Circular Convolution.

EQUIPMENTS:
Software - MATLAB 7.5

Learning Objectives: To make the students familiar with concept of circular convolution
with the help of MATLAB.

THEORY:
Circular convolution is another way of finding the convolution sum of two input signals.
It resembles the linear convolution, except that the sample values of one of the input signals is
folded and right shifted before the convolution sum is found. Also note that circular convolution
could also be found by taking the DFT of the two input signals and finding the product of the
two frequency domain signals. The Inverse DFT of the product would give the output of the
signal in the time domain which is the circular convolution output. The two input signals could
have been of varying sample lengths. But we take the DFT of higher point, which ever signals
levels to. For eg. If one of the signal is of length 256 and the other spans 51 samples, then we
could only take 256 point DFT. So the output of IDFT would be containing 256 samples instead
of 306 samples, which follows N1+N2 – 1 where N1 & N2 are the lengths 256 and 51
respectively of the two inputs. Thus the output which should have been 306 samples long is
fitted into 256 samples. The 256 points end up being a distorted version of the correct signal.
This process is called circular convolution.

PROGRAM:
%circular convolution program:
clc;
clear all;
close all;
disp('circular convolution program');
x=input('enter i/p sequence x(n):');
a=length(x);
disp(a);
h=input('enter i/p sequence h(n):');
b=length(h);
disp(b);
subplot(2,2,1), stem(x);
title('i/p sequence x(n)is:');
xlabel('---->n');
ylabel('---->x(n)');grid;
subplot(2,2,2), stem(h);
title('i/p sequence h(n)is:');
xlabel('---->n');
ylabel('---->h(n)');grid minor;
disp('circular convolution of x(n) & h(n) is y(n):');
if(a>b)
n=a;


 else
n=b;
end
if(a-b~=0)
if(a>b)
h=[h,zeros(1,a-b)];
else
x=[x,zeros(1,b-a)];
end
end
disp(x);
disp(h);
y=zeros(1,n);
for i=1:n
y(i)=0;
k=i;
for j=1:n
y(i)=y(i)+(x(j)*h(k));
if k==1
k=n+1;
end
k=k-1;
end
end
subplot(2,2,[3,4]),stem(y);
title('circular convolution of x(n) & h(n) is:');
xlabel('---->n');
ylabel('---->y(n)');grid;
disp(y);

No comments:

Post a Comment