Biomedical Engineering Reference
In-Depth Information
Appendix 3
R-peak Detection by Amplitude Span Detection of QRS
1. g_span = 0;
mx_slp = 0;
i = 1;
mx_val = x(i),
mn_val = x(i)
%
initialization
2. window formation of 96 ms
3. calculate 8-point average slope, av_slp
4. if av_slp \ mx_slp, skip step 5
5. mx_slp = av_slp
6. span = (mx_val - mn_val) %calculate amplitude span
7. if span \ g_span, skip step 8
8. span = g_span
9. slide window by 20 ms
10. if end of data array, skip step 11
11. go to step 2
12. span
th
= 0.8*g_span; slp
th
= 0.8*mx_slp, again start from beginning of data
array
13. calculate span over 96 ms
14. if span [ = span
th,
go to step 17
15. slide window by 20 ms
16. go to step 13
17. calculate 16-point average slope on upside and downside slope with respect to
maximum and minimum points p
max
and p
min
18. if (slp_r
20-
[ 0) & (slp _r
18+
\ 0) go to step 23
19. if (slp_q
20-
\ 0) & (slp_q
18+
[ 0) skip step 20
20. slide window by 20 ms, go to step 13
21. shift window with respect to p
min
as midpoint, start from beginning of this
window
22. go to step 24
23. Shift window with respect to p
max
as midpoint, start from beginning of this
window
24. calculate av_slp
i
and av_slp
i+25
25. if av_slp
i
\ 0.8*mx_slp go to step 29
26. if av_slp
i+25
\ 0, go to step 31
27. if window end arrived, go to step 33
28. i = i ? 1, go to step 26
29. if window end arrived, i = i ? 200, go to step 13
30. i = i+1, go to step 24
31. find local maximum (say i
max
) i to i ? 50, r_pk = i
max
32. i = i ? 400; go to step 35
33. find local minimum (say, i
min)
at i to i-50, r_pk = i
min
34. i = i ? 400; go to step 35
Search WWH ::
Custom Search