-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathquestion_2_1.m
46 lines (36 loc) · 938 Bytes
/
question_2_1.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
%initialisation
spikeTimesEst = zeros(4000,4);
spikes = zeros(1,4);
T = zeros(1,4);
for z=1:4
str= sprintf('Data_Eval_E_%d.mat',z);
load(str);
table=spikescounter(data);
figure
plot(table(:,2),table(:,1))
xlabel('k')
ylabel('spikes')
str=sprintf('Data Eval %d',z);
title(str)
disp(newline)
str= sprintf('You are in Data_Eval_E_%d ',z);
disp(str)
prompt = 'Enter the approximate number for spikes: ';
spikes(z) = input(prompt);
prompt = 'Enter the approximate number for k: ';
k = input(prompt);
Sn=median(abs(data))/0.6745;
T(z)=k*Sn;
i=1;
flag =0;
for j= 1:1440000
if data(j) >= T(z) && flag == 0
spikeTimesEst(i,z) = j;
flag = 1;
i=i+1;
end
if data(j) < T(z)
flag = 0;
end
end
end