%% this function returns a wavelet array with arbitrary amplitude a0 %% and centered at arbitarry time t0 %% Parameters: %% a0 - amplitude of the waveform peak %% t0 - time at which the peak of the wavelet is located (ms) %% t - array of times at which the output is made(milliseconds) function [wave] = wavelet(a0,t0,t) global wref tref % pre-computed reference wavelet loaded from wavelet.mat % set zeros initially wave = zeros(1,length(t)); % range of indices in t corresponding to the times in tref ind = find( t > tref(1)+t0 & t < tref(end)+t0); % interpolate values of wave(ind) wave(ind) = a0*interp1(tref,wref',t(ind)-t0); end