-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnormalise_signal.m
40 lines (35 loc) · 1.38 KB
/
normalise_signal.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
% function [normalised_signal] = normalise_signal(signal)
%
% This function subtracts the mean and divides by the standard deviation of
% a (1D) signal in order to normalise it for machine learning applications.
%
%% Inputs:
% signal: the original signal
%
%% Outputs:
% normalised_signal: the original signal, minus the mean and divided by
% the standard deviation.
%
% Developed by David Springer for the paper:
% D. Springer et al., ?Logistic Regression-HSMM-based Heart Sound
% Segmentation,? IEEE Trans. Biomed. Eng., In Press, 2015.
%
%% Copyright (C) 2016 David Springer
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
function [normalised_signal] = normalise_signal(signal)
mean_of_signal = mean(signal);
standard_deviation = std(signal);
normalised_signal = (signal - mean_of_signal)./standard_deviation;