forked from jamesheald/COIN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUntitled.m
52 lines (40 loc) · 1.21 KB
/
Untitled.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
clear;
trials = 768;
file = dir(sprintf('data/DMdata/sub01_*.csv'));
filename = file(1).name;
data = readtable(filename);
tasks = [data.perturbation].';
cues = [data.cue_with_perturb].';
perturbations = ([data.target_inds].' - 2) / 2;
% create an object of the COIN class
obj = COIN;
obj.perturbations = perturbations;
obj.cues = cues;
obj.renumber_cues;
obj.runs = 1;
obj.max_cores = feature('numcores');
obj.infer_bias = true;
obj.plot_state_given_context = true;
obj.plot_predicted_probabilities = true;
obj.plot_state = true;
obj.plot_bias_given_context = true;
obj.plot_bias = true;
obj.plot_state_feedback = true;
obj.plot_explicit_component = true;
obj.plot_implicit_component = true;
obj.plot_global_cue_probabilities = true;
obj.plot_local_cue_probabilities = true;
OUTPUT = obj.simulate_COIN;
for run = 1:obj.runs
noiseless_motor_output = OUTPUT.runs{run}.motor_output;
motor_noise = randn(trials,1)*obj.sigma_motor_noise;
motor_output(run,:) = noiseless_motor_output + motor_noise;
state_feedback_output(run,:) = OUTPUT.runs{run}.state_feedback;
end
error = tasks - OUTPUT.weights*motor_output;
figure
plot(error)
grid on;
xlim([0,800]);
ylim([-1.2,1.2]);
legend("perturbations - motor output")