TEAP (Toolbox for Emotion Analysis using Physiological Signals) doc
GSR_feat_peaks_example.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 GSR_feat_peaks_example.m
17 %> @brief Loads a GSR signal, computes it's attributes and displays the signal
18 %
19 %Before all, load TEAP
20 addpath(genpath('../../../'))
21 
22 %Then, we load some data:
23 data = csvread('GSR_example.csv');
24 data = data'; %put in horizontal form
25 
26 
27 %Create the signal, the sampling freq of the signal we have is 1024Hz
28 signal = GSR_aqn_variable(data, 1024);
29 
30 %Clean the signal a bit
31 signal = GSR_filter_basic(signal);
32 
33 %And compute the features:
34 [nbPeaks ampPeaks riseTime posPeaks] = GSR_feat_peaks(signal);
35 
36 %Show the signal
37 Signal_plot(signal);
38 
39 %As now the axis are in seconds, we have to use this function to plot the points
40 rawSig = Signal__get_raw(signal);
41 Signal_plot_pts(signal, posPeaks, rawSig(posPeaks), 'r*');
42 %Note that we didn't had to 'hold on': the function does-it itself.
43 
44 
45 %Take a part of a signal, between 41 and 85 seconds
46 figure;
47 truncated = Signal__get_window(signal, 41, 85);
48 Signal_plot(truncated);
49 
50 [nbPeaks ampPeaks riseTime posPeaks] = GSR_feat_peaks(truncated);
51 rawSig = Signal__get_raw(truncated);
52 Signal_plot_pts(truncated, posPeaks, rawSig(posPeaks), 'r*');
53 
GSR_aqn_variable
function GSR_aqn_variable(in rawGSR, in sampRate)
Signal_plot_pts
function Signal_plot_pts(in Signal, in xvals, in yvals, in props)
Signal__get_raw
function Signal__get_raw(in Signal)
GSR_filter_basic
function GSR_filter_basic(in GSRsignal)
GSR_feat_peaks
function GSR_feat_peaks(in GSRsignal, in ampThresh)
Signal_plot
function Signal_plot(in Signal, in startT, in endT)