-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstimulus_binning.m
31 lines (26 loc) · 968 Bytes
/
stimulus_binning.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
function [transform] = stimulus_binning(numbins)
% Transform is the matrix of the amplitude, extracted from the raw
% stimulus.
load('rawStimuli.mat')
totalmax = 0;
numtrials = numel(rawStimCollector);
transform = zeros(numtrials, numbins);
for t = 1%:numtrials
stim = abs(rawStimCollector{t});
box = ones(1,1000);
convolution = conv(box,stim);
convolution = convolution(1:numel(stim));
stim = convolution*(max(stim)/max(convolution));
% plot(stim);
% hold on;
totalmax = max(totalmax, max(stim));
index = round((1:numbins)*numel(stim)/numbins);
stim = stim(index);
% numzeros = numbins - mod(numel(stim), numbins);
% stim = [stim zeros(1,numzeros)];
% stim = mean(transpose(reshape(stim, [], numbins)));
transform(t,:) = stim;
hold on;
plot(stim)
end
end