-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfreqFunc.m
More file actions
53 lines (28 loc) · 915 Bytes
/
freqFunc.m
File metadata and controls
53 lines (28 loc) · 915 Bytes
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
function eventRes = freqFunc(nodeID,freqData)
psi = [];
freqTimestamps = [];
freqValues = [];
startIndex = -2;
psi = freqData(1,:);
psiRed = psi{3};
psiFed = psi{4};
if(~isempty(psiRed))
if(psiRed(1)==-1)
if(length(psiRed)>1)
startIndex = 2;
end
else
startIndex = 1;
end
end
if(startIndex ~= -2)
for i = startIndex : (length(psiRed)-1)
freqValues = [freqValues,1/(psiRed(i+1) - psiRed(i))];
freqTimestamps = [freqTimestamps,psiRed(i)];
end
end
disp('Freq');
disp(freqValues);
disp(freqTimestamps);
eventRes = {nodeID,5,freqTimestamps,freqValues};
end