-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdop_resp.m
66 lines (59 loc) · 3.14 KB
/
dop_resp.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
%%%% Dopaminergic response profile model
%%%% Type 1 neurons identified by Cohen et al., 2012
% dopaminergic firing rate of a single neuron is surrogate of prediction
% error (rpe)
% 5 Hz baseline, then order of magnitude increase during reward processing
% you get 5Hz by randomly choosing from normal dist with mean of 5, std 1
trainN = 750; % number of training examples
time_steps=50; % trial length
% assume each time step is 100ms, presample: [0-500ms], sample:
% [501-2500ms], delay: [2501-3500ms], reward: 3501ms, post-reward:
% [3600-5000ms]. pre: [0-4], sample: [5-25], delay: [25-35], reward: 35,
% post-reward: [36-50]
% keep track of whether a spike occurs for each time step
spikes = zeros(1,time_steps);
% keep record of each value for all trials
spikes_mat = zeros(trainN,time_steps);
for tN = 1:trainN % which trial
for timeN = 1:time_steps % which time step of current trial
if (5 <= timeN) && (timeN < 7) % 1st part of sample onset window
spikes(timeN) = normrnd(5,1)*1.2; % begin to ramp
elseif (7 <= timeN) && (timeN < 9) % sample onset window
spikes(timeN) = normrnd(5,1)*1.4; % ramping
elseif (9 <= timeN) && (timeN < 11) % sample onset window
spikes(timeN) = normrnd(5,1)*1.6; % ramping
elseif (11 <= timeN) && (timeN < 13) % sample onset window
spikes(timeN) = normrnd(5,1)*1.8; % ramping
elseif (13 <= timeN) && (timeN < 16) % middle of sample onset
spikes(timeN) = normrnd(5,1)*2; % double firing rate
elseif (16 <= timeN) && (timeN < 18) % end of sample onset
spikes(timeN) = normrnd(5,1)*1.8; % ramp down
elseif (18 <= timeN) && (timeN < 20) % end of sample onset
spikes(timeN) = normrnd(5,1)*1.6; % ramp down
elseif (20 <= timeN) && (timeN < 22) % end of sample onset
spikes(timeN) = normrnd(5,1)*1.4; % ramp down
elseif (22 <= timeN) && (timeN <= 24) % end of sample onset
spikes(timeN) = normrnd(5,1)*1.2; % ramp down
elseif (35 <= timeN) && (timeN < 37)% reward time
spikes(timeN) = normrnd(5,1)*1.3; % begin to ramp
elseif (37 <= timeN) && (timeN < 39)% reward time
spikes(timeN) = normrnd(5,1)*2; % double firing rate
elseif (39 <= timeN) && (timeN < 41)% reward time
spikes(timeN) = normrnd(5,1)*1.3; % ramp down
else % baseline, delay and post-reward
spikes(timeN) = normrnd(5,1); % tonic firing
end
end
spikes_mat(tN,:) = spikes; % save trial firing rates
end
% plot 1: avg firing rate across all trials with shaded error bar
figure(1),clf
shadedErrorBar(1:size(spikes_mat,2),mean(spikes_mat),std(spikes_mat),'lineprops',{'r-o','markerfacecolor','r'})
hold on
xline(5,'--','Sample Onset','Color',[0.75 0.75 0.75]);
xline(25,'--','Delay','Color',[0.75 0.75 0.75]);
xline(35,'--','Reward','Color','b');
xticks([0 10 20 30 40 50]); xticklabels({'0','1','2','3','4','5'});
xlabel('Time (s)','FontSize',14), ylabel('Firing rate (spikes/s)','FontSize',14)
title(sprintf('Dopaminergic Response Profile Using %d Trials',trainN),'FontSize',18)
export_fig trial_avg.png -transparent % no background