yilcih
Newbie level 1
overlap save
Hi. I wrote the code below to do fast-convolution with overlap-save method, but it is not working; i know that somewhere i need to add zeros to x but where; pls help =)
function myfunc
function y = OverlapSave(x, h, N)
h = h);
x = x);
P = length(h);
N = length(x);
D = N-P+1;
x = [zeros(P-1,1);x];
H = fft(h,N);
y = [];
for r = 0:fix(N/D)-1
xr = x(r*D+1:r*D+N);
Xr = fft(xr);
Yrp = Xr .* H;
yrp = ifft(Yrp);
y = [y; yrp(P:N)];
end
Hi. I wrote the code below to do fast-convolution with overlap-save method, but it is not working; i know that somewhere i need to add zeros to x but where; pls help =)
function myfunc
function y = OverlapSave(x, h, N)
h = h);
x = x);
P = length(h);
N = length(x);
D = N-P+1;
x = [zeros(P-1,1);x];
H = fft(h,N);
y = [];
for r = 0:fix(N/D)-1
xr = x(r*D+1:r*D+N);
Xr = fft(xr);
Yrp = Xr .* H;
yrp = ifft(Yrp);
y = [y; yrp(P:N)];
end