-
Notifications
You must be signed in to change notification settings - Fork 13
/
find_peak_ECGpce.m
executable file
·61 lines (43 loc) · 1.61 KB
/
find_peak_ECGpce.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
function [data_peak] = find_peak_ECGpce(data)
%% 寻找前2秒data信号的最大值的%40作为初始阈值
max=data(1);
for i=1:2000
if data(i)>=max
max=data(i);
end
thres=max*0.4;
end
%对之后的recg进行处理
k=1;
for i=2000:length(data)-110
%找出信号中前后20个点导数大于零,并且刚好大于阈值的点(上升沿上超出阈值的点)
if data(i)<=thres
if data(i+1)>=thres
if data(i+2)>data(i-2)%刚好大于阈值的点
if k==1
data_peak_1(k,1)=i;
[locs,pks]=findMax(data,i,100);
data_peak_1(k,2)=pks;
data_peak_1(k,3)=locs;
k=k+1;
else
if i-data_peak_1(k-1,1)>100
data_peak_1(k,1)=i;
[locs,pks]=findMax(data,i,100);
data_peak_1(k,2)=pks;
data_peak_1(k,3)=locs; %波峰位置
k=k+1;
end
end
if k>6
thres=(data_peak_1(k-5,2)+data_peak_1(k-4,2)+data_peak_1(k-3,2)+data_peak_1(k-2,2)+data_peak_1(k-1,2))/5*0.4;
end
end
end
end
end
data_peak(:,1)=data_peak_1(:,3);
for i=1:k-1
weizhi=data_peak_1(i,3);
data_peak(i,2)=data(weizhi);
end