-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtimeEstimate.m
63 lines (59 loc) · 1.41 KB
/
timeEstimate.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
function [ hopPoint ] = timeEstimate( FE, THRESHOLD )
%UNTITLED2 Summary of this function goes here
% FE:载波频率对应点
% THRESHOLD:跳变门限
%预处理
for i=2:length(FE)-1
if abs(FE(i)-FE(i-1)) > THRESHOLD
if abs(FE(i+1)-FE(i-1)) < THRESHOLD
FE(i)=FE(i-1);
end
end
end
%第一跳
for i=1:length(FE)-19
k=0;
for j=1:19
if FE(i+j)-FE(i) < THRESHOLD
k=k+1;
else break;
end
end
if k==19
hopPoint(1)=i;
break;
end
end
%跳变点
k=2;
n=0;
flag=1;%1--寻找跳变点 0--寻找起始点
if i<length(FE)-19
ref_freq=mean(FE(hopPoint(1):hopPoint(1)+19));
for j=hopPoint(1)+20:length(FE)-19
if 1==flag
if abs(FE(j)-ref_freq)>THRESHOLD && abs(FE(j+1)-ref_freq) > THRESHOLD && abs(FE(j+2)-ref_freq) > THRESHOLD
hopPoint(k)=j;
k=k+1;
flag=0;
end
else
for jj=0:18
if abs(FE(j+jj)-FE(j-1)) < THRESHOLD
n=n+1;
else break;
end
if 19==n
hopPoint(k)=j-1;
ref_freq=mean(FE(hopPoint(k):hopPoint(k)+19));
k=k+1;
flag=1;
end
end
n=0;
end
end
else
hopPoint=[];
end
end