-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilter_configuration.m
More file actions
89 lines (34 loc) · 1.25 KB
/
filter_configuration.m
File metadata and controls
89 lines (34 loc) · 1.25 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
function [filtered_PPG] = filter_configuration(raw_PPG,filter_type,order,Fs,fL,fH)
Fn = Fs/2;
switch filter_type
case 1
[A,B,C,D] = butter(order,[fL fH]/Fn);
[filter_SOS,g] = ss2sos(A,B,C,D);
filtered_PPG = filtfilt(filter_SOS,g,raw_PPG);
case 2
[A,B,C,D] = cheby1(order,0.1,[fL fH]/Fn);
[filter_SOS,g] = ss2sos(A,B,C,D);
filtered_PPG = filtfilt(filter_SOS,g,raw_PPG);
case 3
[A,B,C,D] = cheby2(order,20,[fL fH]/Fn);
[filter_SOS,g] = ss2sos(A,B,C,D);
filtered_PPG = filtfilt(filter_SOS,g,raw_PPG);
case 4
[A,B,C,D] = ellip(order,0.1,30,[fL fH]/Fn);
[filter_SOS,g] = ss2sos(A,B,C,D);
filtered_PPG = filtfilt(filter_SOS,g,raw_PPG);
case 5
d = fir1(order,[fL fH]/Fn,'bandpass');
filtered_PPG = filtfilt(d,1,raw_PPG);
case 6
d = designfilt('bandpassfir','FilterOrder',order,'StopbandFrequency1',fL-0.2,'PassbandFrequency1',fL,...
'PassbandFrequency2',fH,'StopbandFrequency2',fH+2,'DesignMethod','ls','SampleRate',sample_freq);
filtered_PPG = filtfilt(d,raw_PPG);
case 7
filtered_PPG = smooth(raw_PPG,order);
case 8
filtered_PPG = medfilt1(raw_PPG,order);
case 9
filtered_PPG= wden(raw_PPG,'modwtsqtwolog','s','mln',order,'db2');
end
end