Code covered by the BSD License  

Highlights from
circ conv 4 unequal length sequences

circ conv 4 unequal length sequences

by

 

computes the circular convolution for two sequences of unequal lengths

[y]=circonv(x,h);
%circular convolution for non equal sequences


function [y]=circonv(x,h);
if(length(h)<length(x))
    h1=[h,zeros(1,length(x)-length(h))];
else
    h1=h;
end;
if(length(h)>length(x))
    x1=[x,zeros(1,length(h)-length(x))];
else
    x1=x;
end;
X=zeros(length(x1),length(x1));
X(1:length(x1))=x1(1:length(x1));
for i=2:length(x1)
    X(1,i)=X(length(x1),i-1);
    X(2:length(x1),i)=X(1:length(x1)-1,i-1);
end;
y=X*h1';

Contact us