Usage: [Feat,t]=acoustic_features_MB(data,movingwin,params); Input: Note units have to be consistent. Thus, if movingwin is in seconds, Fs has to be in Hz. see chronux.m for more information. data Time series -- required movingwin (in the form [window winstep] i.e length of moving window and step size) Note that units here have to be consistent with units of Fs - required params: structure with fields tapers, pad, Fs, fpass - optional tapers : precalculated tapers from dpss or in the one of the following forms: (1) A numeric vector [TW K] where TW is the time-bandwidth product and K is the number of tapers to be used (less than or equal to 2TW-1). (2) A numeric vector [W T p] where W is the bandwidth, T is the duration of the data and p is an integer such that 2TW-p tapers are used. In this form there is no default i.e. to specify the bandwidth, you have to specify T and p as well. Note that the units of W and T have to be consistent: if W is in Hz, T must be in seconds and vice versa. Note that these units must also be consistent with the units of params.Fs: W can be in Hz if and only if params.Fs is in Hz. The default is to use form 1 with TW=3 and K=5 pad (padding factor for the FFT) - optional. Defaults to 0. e.g. For N = 500, if PAD = 0, we pad the FFT to 512 points; if PAD = 2, we pad the FFT to 2048 points, etc. Fs (sampling frequency) - optional. Default 1. fpass (frequency band to be used in the calculation in the form [fmin fmax])- optional. Default all frequencies between 0 and Fs/2 Output: Featt Features: 3-dim time series, <S>, <log(S)> and <f S>/<S>. first two averages computed over fpass. t (times)

- feature_calc_script feature_calc_script

0001 function [Feat,S,t,f]=acoustic_features_MB(data,movingwin,params) 0002 0003 % Usage: 0004 % [Feat,t]=acoustic_features_MB(data,movingwin,params); 0005 % Input: 0006 % Note units have to be consistent. Thus, if movingwin is in seconds, Fs 0007 % has to be in Hz. see chronux.m for more information. 0008 % data Time series -- required 0009 % movingwin (in the form [window winstep] i.e length of moving 0010 % window and step size) 0011 % Note that units here have 0012 % to be consistent with 0013 % units of Fs - required 0014 % params: structure with fields tapers, pad, Fs, fpass 0015 % - optional 0016 % tapers : precalculated tapers from dpss or in the one of the following 0017 % forms: 0018 % (1) A numeric vector [TW K] where TW is the 0019 % time-bandwidth product and K is the number of 0020 % tapers to be used (less than or equal to 0021 % 2TW-1). 0022 % (2) A numeric vector [W T p] where W is the 0023 % bandwidth, T is the duration of the data and p 0024 % is an integer such that 2TW-p tapers are used. In 0025 % this form there is no default i.e. to specify 0026 % the bandwidth, you have to specify T and p as 0027 % well. Note that the units of W and T have to be 0028 % consistent: if W is in Hz, T must be in seconds 0029 % and vice versa. Note that these units must also 0030 % be consistent with the units of params.Fs: W can 0031 % be in Hz if and only if params.Fs is in Hz. 0032 % The default is to use form 1 with TW=3 and K=5 0033 % 0034 % pad (padding factor for the FFT) - optional. Defaults to 0. 0035 % e.g. For N = 500, if PAD = 0, we pad the FFT 0036 % to 512 points; if PAD = 2, we pad the FFT 0037 % to 2048 points, etc. 0038 % Fs (sampling frequency) - optional. Default 1. 0039 % fpass (frequency band to be used in the calculation in the form 0040 % [fmin fmax])- optional. 0041 % Default all frequencies between 0 and Fs/2 0042 % 0043 % Output: 0044 % Featt Features: 3-dim time series, <S>, <log(S)> and <f S>/<S>. 0045 % first two averages computed over fpass. 0046 % t (times) 0047 0048 params1=params; 0049 fpass=params.fpass;fpass1=fpass; 0050 fpass1(1)=0; 0051 params1.fpass=fpass1; 0052 [S,t,f]=mtspecgramc(diff(data),movingwin,params1); 0053 Feat=zeros(length(t),3); 0054 pass=floor(fpass/params.Fs*length(f))+1; 0055 Feat(:,1)=mean(S(:,pass(1):pass(2)),2); 0056 Feat(:,2)=mean(log(S(:,pass(1):pass(2))),2); 0057 f=f(:)'; 0058 freq=repmat(f,length(t),1); 0059 % Feat(:,3)=mean(freq.*S,2)./mean(S,2); 0060 Feat(:,3)=max(S,[],2)./median(S,2);

Generated on Fri 28-Sep-2012 12:34:30 by