Detecting stimulus onsets
3 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!