overlap-save method in MATLAB?

Status
Not open for further replies.

yilcih

Newbie level 1
Joined
Apr 1, 2007
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,294
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
 

overlap save matlab

Hi

Red color portion of your code is giving error


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;

Try this.....
x = [zeros(P-1,1)' x];
 

overlap save method

here the m file for the matlab overlab save method. so u can direct store this m file in to your work directory and go for the overlapsave method


function [y] = ovrlpsav(x,h,N)
% Overlap-Save method of block convolution
% ----------------------------------------
% [y] = ovrlpsav(x,h,N)
% y = output sequence
% x = input sequence
% h = impulse response
% N = block length
%
Lenx = length(x); M = length(h);
M1 = M-1; L = N-M1;
h = [h zeros(1,N-M)];
%
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
xk = x(k*L+1:k*L+N);
Y(k+1, = circonvt(xk,h,N);
end
Y = Y,M:N)'; % discard the first (M-1) samples
y = (Y))'; % assemble output
 

hi... i need to create the function overlap save or overlap add...can anyone help me? i assume that in the begining i generate some values for input signal and also for the impulse reponse h.. this values are chosed by me...but what happens next? i mean how can I divide the input signal into blocks of length M..qnd is there a mathematical relation between M and the length of the input signal N?
 

Hi,

I want to to 50% overlap on Hanning window, can any body suggets how to perform this using MATLAB? please help me, am implementing PSOLA algorithm
Thanks in advance
Chaithra S
 

Is there any way to convert this matlab code into Java?? I want to implement the overlap save method in Java.
 

hi i hav a problem in this code cox its nt giv me right answer plz write another simple
code
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…