TEAP (Toolbox for Emotion Analysis using Physiological Signals) doc
Signal_filter1_low_mean.m
Go to the documentation of this file.
1 %This file is part of TEAP.
2 %
3 %TEAP is free software: you can redistribute it and/or modify
4 %it under the terms of the GNU General Public License as published by
5 %the Free Software Foundation, either version 3 of the License, or
6 %(at your option) any later version.
7 %
8 %TEAP is distributed in the hope that it will be useful,
9 %but WITHOUT ANY WARRANTY; without even the implied warranty of
10 %MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 %GNU General Public License for more details.
12 %
13 %You should have received a copy of the GNU General Public License
14 %along with TEAP. If not, see <http://www.gnu.org/licenses/>.
15 %
16 %> @file Signal_filter1_low_mean.m
17 %> @brief Filters the signal with a low pass mean filtering
18 %
19 %> @param Signal: the signal to filter. Not a bulk signal !
20 %> @param windowSize: the window size (in samples)
21 %
22 %> @retval Signal: the newly filtered signal
23 %
24 %> @author Copyright Frank Villaro-Dixon, 2014
25 function Signal = Signal_filter1_low_mean(Signal, windowSize)
26 
27 if(nargin ~= 2 || nargout ~= 1)
28  error('Usage: Signal = Signal_filter1_low_mean(Signal, windowSize)');
29 end
30 
31 Signal__assert_mine(Signal);
32 
33 
34 raw = Signal__get_raw(Signal);
35 
36 filtAvgEls = ones(1, windowSize)/windowSize;
37 raw = filtfilt(filtAvgEls, 1, [repmat(raw(1), windowSize, 1); raw']);
38 
39 raw = raw';
40 
41 %take out first second
42 offset = windowSize + 1;
43 raw = raw(offset:end);
44 %and say that the signal was offseted by offset frames
45 Signal = Signal__set_offset(Signal, Signal__get_offset(Signal) + offset);
46 
47 Signal = Signal__set_raw(Signal, raw);
48 
49 %Indicate that the signal has been filtered
50 Signal = Signal__set_preproc_lowpass(Signal);
51 
Signal__set_offset
function Signal__set_offset(in Signal, in offset)
Signal__set_raw
function Signal__set_raw(in Signal, in raw)
Signal__get_raw
function Signal__get_raw(in Signal)
Signal__assert_mine
function Signal__assert_mine(in Signal)
Signal__set_preproc_lowpass
function Signal__set_preproc_lowpass(in Signal)
Signal__get_offset
function Signal__get_offset(in Signal)
Signal_filter1_low_mean
function Signal_filter1_low_mean(in Signal, in windowSize)