Home > utility > buffer2.m

buffer2

PURPOSE ^

BUFFER2 Frame blocking

SYNOPSIS ^

function out = buffer2(y, frameSize, overlap)

DESCRIPTION ^

 BUFFER2 Frame blocking
    This is almost the same as "buffer" except that there is no leading zeros

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function out = buffer2(y, frameSize, overlap)
0002 % BUFFER2 Frame blocking
0003 %    This is almost the same as "buffer" except that there is no leading zeros
0004 
0005 %    Roger Jang, 20010908
0006 
0007 if nargin<3, overlap=0; end
0008 if nargin<2, frameSize=256; end
0009 
0010 y = y(:);
0011 step = frameSize-overlap;
0012 frameCount = floor((length(y)-overlap)/step);
0013 
0014 out = zeros(frameSize, frameCount);
0015 for i=1:frameCount,
0016     startIndex = (i-1)*step+1;
0017     out(:, i) = y(startIndex:(startIndex+frameSize-1));
0018 end

Generated on Tue 01-Jun-2010 09:50:34 by m2html © 2003