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);

siglen=length(ip);

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:

https://figshare.com/articles/software/sample_advance_m/5297188

 

Hilbert Envelope Extraction

Home page