function y = slow_circonv(x,h,N); % Slow circular convolution .... % y = slow_circonv(x,h,N) % x, h = input and sample response vectors % N is size of circular buffer % Convolution is implemented without any MATLAB efficiencies lenx = length(x); lenh = length(h); lent = lenx+lenh-1; x = [x zeros(1,lenh-1)]; h = [h zeros(1,lenx-1)]; y = zeros(1,lenx+lenh-1); for n = 1:lent, for k = max(1,2-lenh):min(n,lenx), y(n) = y(n) + x(k)*h(1+n-k); % adjustment for indexing from 1 end if(rem(n,100))==0 disp(n) end end for n = N+1:lent, y(rem(n,N)) = y(rem(n,N)) + y(n); end leny = length(y); if(Nleny)y = [y zeros(1,N-leny)]; end