Detecting stimulus onsets

3 Ansichten (letzte 30 Tage)
Abhilash
Abhilash am 15 Sep. 2011
Hey guys,
So I have this array which contains the waveform of the stimulus used. We played to the rat a ping sound which lasts for 100 ms and occurs every 750 ms. Unfortunately, the machine in this particular protocol did not save an events file so I need to figure out the stimulus onset times myself.
The problem is that it is not a homogeneous stimulation pattern. First we turned the stimulus on for sometime, then shut it off to adjust something, and then played it for a while and then we turned it off again to adjust something and then turned it on till the end. Attached is a figure that shows the pattern.
I tried doing this to get the stimulus onset times -
% Making pieces of the stimulus
avg_stim_form = mean(stimulus_waveform);
std_stim_form = std(stimulus_waveform);
norm_stimulus = stimulus_waveform - avg_stim_form;
ratio = round(norm_stimulus./std_stim_form);
stim_form = zeros(1,length(stimulus_waveform));
stim_form(ratio>0.5) = 1;
stim_start = find(stim_form==1, 1 );
stim_form = stim_form(stim_start:end);
d = diff(stim_form);
stimtimes = find(d==1);
This didn't work out because the threshold is too high. In the waveform of the ping, there are many 0 crossings, so howmuchever I lower the threshold for detection, I will still get false positives. I'd be grateful if someone could help me out.
Thanks.

Antworten (0)

Kategorien

Mehr zu App Building finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by