1 %This file is part of TEAP.
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.
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.
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/>.
17 %> @brief Computes Skin EMG featuEMG
18 %> @param EMGsignal: the EMG signal.
19 %> @param varargin: you can choose which features to extract (see featureSelector)
20 %> the list of available features is:
21 %> - mean_: average temprature
22 %> - std_: standard deviation of the EMG
23 %> - kurtosis_: Kurtosis of the EMG
24 %> - skewness_: skewness of the EMG
25 %> - EMG_power: power spectral power above 20Hz
27 %> @retval EMG_feats: list of featuEMG values
28 %> @retval EMG_feats_names: names of the computed features (it is good pratice to
29 %> check
this vector since the order of requested features
30 %> can be different than the requested one)
31 %> @author Copyright Frank Villaro-Dixon, 2015
34 %> @b WARNING:
this function will give
'strange' results when applied on a relative
37 function [EMG_feats, EMG_feats_names] =
EMG_feat_extr(EMGsignal, varargin)
39 % Check inputs and define unknown values
42 %Make sure we have a EMG signal
46 % Define full feature list and get featuEMG selected by user
47 featuEMGNames = {
'mean_',
'std_',
'kurtosis_',
'skewness_',
'EMG_power'};
50 %If some featuEMG are selected
51 if(~isempty(EMG_feats_names))
54 if any(strcmp(
'mean_',EMG_feats_names)) || any(strcmp(
'std_',EMG_feats_names)) || any(strcmp(
'kurtosis_',EMG_feats_names)) || any(strcmp(
'skewness_',EMG_feats_names))
57 %EMG power above 20Hz;
this is associated with muscule contractions
58 if any(strcmp(
'EMG_power',EMG_feats_names))
59 bands = [20,samprate/2];
63 %Write the values to the final vector output
64 for (i = 1:length(EMG_feats_names))
65 eval(['EMG_feats(i,:) =
' EMG_feats_names{i} ';
']);
68 else %no featuEMG selected