


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 form [NW K] e.g [3 5]) -- optional. If not
specified, use [NW K]=[3 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)

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 form [NW K] e.g [3 5]) -- optional. If not 0017 % specified, use [NW K]=[3 5] 0018 % pad (padding factor for the FFT) - optional. Defaults to 0. 0019 % e.g. For N = 500, if PAD = 0, we pad the FFT 0020 % to 512 points; if PAD = 2, we pad the FFT 0021 % to 2048 points, etc. 0022 % Fs (sampling frequency) - optional. Default 1. 0023 % fpass (frequency band to be used in the calculation in the form 0024 % [fmin fmax])- optional. 0025 % Default all frequencies between 0 and Fs/2 0026 % 0027 % Output: 0028 % Featt Features: 3-dim time series, <S>, <log(S)> and <f S>/<S>. 0029 % first two averages computed over fpass. 0030 % t (times) 0031 0032 params1=params; 0033 fpass=params.fpass;fpass1=fpass; 0034 fpass1(1)=0; 0035 params1.fpass=fpass1; 0036 [S,t,f]=mtspecgramc(diff(data),movingwin,params1); 0037 Feat=zeros(length(t),3); 0038 pass=floor(fpass/params.Fs*length(f))+1; 0039 Feat(:,1)=mean(S(:,pass(1):pass(2)),2); 0040 Feat(:,2)=mean(log(S(:,pass(1):pass(2))),2); 0041 f=f(:)'; 0042 freq=repmat(f,length(t),1); 0043 % Feat(:,3)=mean(freq.*S,2)./mean(S,2); 0044 Feat(:,3)=max(S,[],2)./median(S,2);