% [sigDC, sigAC, dp]=dpSweep(optFunc,p,dpList,dpStep, af) % % This function will sweep the demodulation phases of probes and returns % signals at those demodulation phases. % % == Inputs === % % optFunc: A function handle. This function must take a parameter struct % as an argument and returns an Optickle instance. % % p: A struct to be given as an argument to optFunc. This struct must have % fields of the same names as the elements of dpList. These field has to % be used in the Optickle model as demodulation phases. % % dpList: A cell array containing the names of the fields in p which % represent demodulation phases of the probes. % % dpStep: A step size of the demodulation phase sweep (in degrees). % % af: An audio frequency at which sigAC is evaluated. % % === Outputs === % % sigDC: DC signals at each probe. [Nprb * Ndp] % % sigAC: AC signals at each probe. [Nprb * Ndrv * Ndp] % % dp: A vector of demodulation phases. [Ndp * 1] function [sigDC, sigAC, dp] = dpSweep(optFunc,p,dpList,dpStep,af) sigDC=[]; sigAC=[]; dp=[-180:dpStep:180]; numPhasePoints=length(dp); h=waitbar(0,'Sweeping demodulation phases'); for ii = 1:numPhasePoints, waitbar(ii/numPhasePoints,h); x=dp(ii); %Assign new demodulation phase for jj=1:length(dpList), p=setfield(p,dpList{jj},x); end %Construct a model opt= optFunc(p); %Tickle [fDC, sigDC1,sigAC1] = tickle(opt, [], af); sigDC=[sigDC,sigDC1]; sigAC(:,:,ii)=sigAC1; end close(h);