I understand that we can use the buffer function in matlab to split a long signal into overlapping frames. But is there any functions that we can use to put the frames back to reconstruct the signal?

Here's my current code in Matlab

n = 0.1:0.1:100;
y = sin(n*pi*0.5)';
Nw = 100;  % window length
Nh = 25;   % hop size
Y = buffer(y,Nw,Nw-Nh, 'nodelay');  % Y is the matrix containing the overlapping frames

What I want to do next is to use Y to reconstruct the original signal y. Something like this

yNew = unbuffer(Y, Nw, Nw-Nh)

Of course there is no such function as unbuffer, not that I've known of. So my question is, is there any function available to do the job of unbuffer ?

The situation is similar to this question here: https://www.reddit.com/r/matlab/comments/361y9w/reverse_buffer_function/, which was 5 years ago and still received no answers.


2 Answers 2


If you want to do any overlap and arbitrarily large vectors while being fast it is a bit cumbersome.

If you only do 50% overlap, then it is straight forward to write an unbuffer function


unbuffer in Python; helpful post. Nice visuals in MATLAB docs (bottom).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.