% data is in object gsr and already preprocessed
% for this example we define four (!) spots of interest:
% - cue (time of stimulus minus 2 secs)
% - onset (time of stimulus),
% - delay of response (minimum before peak),
% - and peak of response (amplitude)
spotnames = {'cue', 'onset', 'delay', 'peak'};
spottype = {'cue', 'onset', 'min', 'max'};
% the spot values are set to empty arrays with size 0x2!
% this tells plotcurves to autodetect...
spot = {zeros(0,2), zeros(0,2), zeros(0,2), zeros(0, 2)};
% then we define the variables of interest:
% NOTE: since we have a CUE spot, all spot indices shift by one!
% - Latency (defined as x-diff between onset and delay)
% - Response time (defined as x-diff between delay and peak)
% - Base amplitude (defined as y-value at delay)
% - Peak amplitude (defined as y-value at peak)
% - Peak-to-peak response amplitude (defined as y-diff between delay and peak)
% additionally, we define that for the response amplitude, the log+1 transform
% should be applied after we're done
vars = struct( ...
'name', {'Latency', 'Resp. time', 'Base ampl.', 'Peak ampl.', 'Resp. ampl.'}, ...
'calc', {'dx', 'dx', 'y', 'y', 'dy'}, ...
'spot', {[2, 3], [3, 4], [3], [4], [3, 4]}, ...
'trans', {'none', 'none', 'none', 'none', 'log+1'});
% re-using the variables definition from above, options:
% - data is now in channel 10 (filtered!)
% - original data is in channel 1 (pre-filter)
% - onsets are coded in channel 8 (0Volts nothing, 5 Volts boxes)
% - cue onffset is 2 seconds
% - thus, the window is increased! [-4, 20]
% - variables and spots as defined
pcopts = struct( ...
'dchannel', 10, ...
'odchannel', 1, ...
'ochannel', 8, ...
'cuediff', 2, ...
'owin', [-4, 20],...
'var', vars, ...
'spot', {spot}, ...
'spotnames', {spotnames}, ...
'spottype', {spottype});
% now we call plotcurves
plotcurves(gsr, pcopts);