1
+ % function homomorphic_envelope = Homomorphic_Envelope_with_Hilbert(input_signal, sampling_frequency,lpf_frequency,figures)
2
+ %
3
+ % This function finds the homomorphic envelope of a signal, using the method
4
+ % described in the following publications:
5
+ %
6
+ % S. E. Schmidt et al., ?Segmentation of heart sound recordings by a
7
+ % duration-dependent hidden Markov model.,? Physiol. Meas., vol. 31, no. 4,
8
+ % pp. 513?29, Apr. 2010.
9
+ %
10
+ % C. Gupta et al., ?Neural network classification of homomorphic segmented
11
+ % heart sounds,? Appl. Soft Comput., vol. 7, no. 1, pp. 286?297, Jan. 2007.
12
+ %
13
+ % D. Gill et al., ?Detection and identification of heart sounds using
14
+ % homomorphic envelogram and self-organizing probabilistic model,? in
15
+ % Computers in Cardiology, 2005, pp. 957?960.
16
+ % (However, these researchers found the homomorphic envelope of shannon
17
+ % energy.)
18
+ %
19
+ % In I. Rezek and S. Roberts, ?Envelope Extraction via Complex Homomorphic
20
+ % Filtering. Technical Report TR-98-9,? London, 1998, the researchers state
21
+ % that the singularity at 0 when using the natural logarithm (resulting in
22
+ % values of -inf) can be fixed by using a complex valued signal. They
23
+ % motivate the use of the Hilbert transform to find the analytic signal,
24
+ % which is a converstion of a real-valued signal to a complex-valued
25
+ % signal, which is unaffected by the singularity.
26
+ %
27
+ % A zero-phase low-pass Butterworth filter is used to extract the envelope.
28
+ %% Inputs:
29
+ % input_signal: the original signal (1D) signal
30
+ % samplingFrequency: the signal's sampling frequency (Hz)
31
+ % lpf_frequency: the frequency cut-off of the low-pass filter to be used in
32
+ % the envelope extraciton (Default = 8 Hz as in Schmidt's publication).
33
+ % figures: (optional) boolean variable dictating the display of a figure of
34
+ % both the original signal and the extracted envelope:
35
+ %
36
+ %% Outputs:
37
+ % homomorphic_envelope: The homomorphic envelope of the original
38
+ % signal (not normalised).
39
+ %
40
+ % This code was developed by David Springer for comparison purposes in the
41
+ % paper:
42
+ % D. Springer et al., ?Logistic Regression-HSMM-based Heart Sound
43
+ % Segmentation,? IEEE Trans. Biomed. Eng., In Press, 2015.
44
+ %
45
+ %% Copyright (C) 2016 David Springer
46
+
47
+ %
48
+ % This program is free software: you can redistribute it and/or modify
49
+ % it under the terms of the GNU General Public License as published by
50
+ % the Free Software Foundation, either version 3 of the License, or
51
+ % any later version.
52
+ %
53
+ % This program is distributed in the hope that it will be useful,
54
+ % but WITHOUT ANY WARRANTY; without even the implied warranty of
55
+ % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56
+ % GNU General Public License for more details.
57
+ %
58
+ % You should have received a copy of the GNU General Public License
59
+ % along with this program. If not, see <http://www.gnu.org/licenses/>.
60
+
61
+ function homomorphic_envelope = Homomorphic_Envelope_with_Hilbert(input_signal , sampling_frequency ,lpf_frequency ,figures )
62
+
63
+ if nargin < 4,
64
+ figures = 0 ;
65
+ end
66
+ if nargin < 3,
67
+ figures = 0 ;
68
+ lpf_frequency = 8 ;
69
+ end
70
+
71
+ % 8Hz, 1st order, Butterworth LPF
72
+ [B_low ,A_low ] = butter(1 ,2 * lpf_frequency / sampling_frequency ,' low' );
73
+ homomorphic_envelope = exp(filtfilt(B_low ,A_low ,log(abs(hilbert(input_signal )))));
74
+
75
+ % Remove spurious spikes in first sample:
76
+ homomorphic_envelope(1 ) = [homomorphic_envelope(2 )];
77
+
78
+ if (figures )
79
+ figure(' Name' , ' Homomorphic Envelope' );
80
+ plot(input_signal );
81
+ hold on ;
82
+ plot(homomorphic_envelope ,' r' );
83
+ legend(' Original Signal' ,' Homomorphic Envelope' )
84
+ end
0 commit comments