You are on page 1of 1

%circular conv using matrix method

clear all;
close all;
x=[1 2 3 4]
y=[4 5 6 6]
a=circshift(x,1);
b=circshift(a,1);
c=circshift(b,1);

l=max(length(x),length(y));
for i=1:l
A(i,1)=x(i);
A(i,2)=a(i);
A(i,3)=b(i);
A(i,4)=c(i);
end
A

Z=A*y'
subplot(2,1,1)
stem(Z)
title('circular conv using matrix method')
Z1=cconv(x,y,l)
subplot(2,1,2)
stem(Z1)
title('using cconv command')

You might also like