skip to content

Centre for Neuroscience in Education


Create a new tab in the MATLAB editor window, and copy the entire text below into the window, and then save window as sample_advance.m


%%%% function to time-advance signal, preserve buffer length and pad with externally defined value

function op=sample_advance(ip, nshift, padding);


ip(1:siglen-nshift) = ip(nshift+1:siglen); %%%%% shift the bulk

ip(1+siglen-nshift:siglen) = padding; %%% obliterate bit at end with externally-defined fill

op = ip;

The function can also be found here:


Hilbert Envelope Extraction

Home page