function [y] = slow_ovrlpsavFFT(x,h,N) % Overlap-Save method of block convolution % ---------------------------------------- % [y] = slow_ovrlpsavFFT(x,h,N) % y = output sequence % x = input sequence % h = impulse response % N = block length % %Implements overlap-save without MATLAB eficiencies % This version, nevertheless, uses FFT routines (slow ones, of course) to % execute the circular convolution. Lenx = length(x); M = length(h); M1 = M-1; L = N-M1; h = [h zeros(1,N-M)]; [Hk] = slow_fft(h,N); Leny = Lenx + M -1; % x = [zeros(1,M1), x, zeros(1,N-1)]; % preappend (M-1) zeros K = floor((Lenx+M1-1)/(L)); % # of blocks Y = zeros(K+1,N); % convolution with succesive blocks for k=0:K disp(k*L) xk = x(k*L+1:k*L+N); [Xk] = slow_fft(xk,N); % These steps perform the circular Ytemp1 = Xk.*Hk; % convolution using the FFT Y(k+1,:) = slow_ifft(Ytemp1,N); % routines. end Y = Y(:,M:N)'; % discard the first (M-1) samples y = (Y(:))'; % assemble output y = real(y(1:Leny)); % remove extra zeros at end