% Return a 'jittered' version of the process % Pin. isirand is a function handle that returns % random number from the jitter distribution. % dt is the binsize of the (to determine units). % Pout=jitter(Pin,jrand,dt) % To impose a Gaussian (normally distributed) % jitter, you might call: % pout=jitter(pin,@randn,.1); % For more examples using function handles in % this situation, see the notes for renewal.m function Pout=jitter(Pin,isirand,dt); % Initialize Pout n=numel(Pin); Pout=zeros(1,n); % Get a representation of Pin % in terms of spike times s=find(Pin); % Fill Pout making sure not to % use indices that are out of bounds for i=1:numel(s) J=round(s(i)+feval(isirand)/dt); if J>0 && J