You are on page 1of 1

disp('circular convolution using time domain approach')

N= input('N= '); %lengths of sequences


x= input('enter x= '); %sequence x(n)
h= input('enter h = '); %sequence h(n)
n=0;
disp('the result of circular convolution is ')
for m=1:N %this'for' loop for circular shifting
sum = 0;
for k= 1:N %this 'if 'loop if for summation
if((m-k >= 0)) % this 'if' loop if for circular folding
n= m-k+1;
else
n= m-k+N+1;
end
sum = sum + x(k)*h(n);
end
disp(sum) % display the result of circular convolution
end

circular convolution using time domain approach


N=3
enter x= [1 5 2]
enter h = [2 5 8]
the result of circular convolution is
52

31

37

You might also like