-
Notifications
You must be signed in to change notification settings - Fork 0
/
getiavfeat.m
73 lines (64 loc) · 1.68 KB
/
getiavfeat.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
%
% GETIAVFEAT Gets the IAV feature (Integrated Absolute Value).
%
% feat = getiavfeat(x,winsize,wininc,datawin,dispstatus)
%
% Author Adrian Chan
%
% This function computes the IAV feature of the signals in x,
% which are stored in columns.
%
% The signals in x are divided into multiple windows of size
% winsize and the windows are space wininc apart.
%
% Inputs
% x: columns of signals
% winsize: window size (length of x)
% wininc: spacing of the windows (winsize)
% datawin: window for data (e.g. Hamming, default rectangular)
% must have dimensions of (winsize,1)
% dispstatus:zero for no waitbar (default)
%
% Outputs
% feat: IAV value in a 2 dimensional matrix
% dim1 window
% dim2 feature (col i is the features for the signal in column i of x)
%
% Modifications
% 05/01/14 AC Change feat output so that dim1 is window and dim2 is feature
% 04/08/04 AC First created.
function feat = getiavfeat(x,winsize,wininc,datawin,dispstatus)
if nargin < 5
if nargin < 4
if nargin < 3
if nargin < 2
winsize = size(x,1);
end
wininc = winsize;
end
datawin = ones(winsize,1);
end
dispstatus = 0;
end
datasize = size(x,1);
Nsignals = size(x,2);
numwin = floor((datasize - winsize)/wininc)+1;
% allocate memory
feat = zeros(numwin,Nsignals);
if dispstatus
h = waitbar(0,'Computing IAV features...');
end
st = 1;
en = winsize;
for i = 1:numwin
if dispstatus
waitbar(i/numwin);
end
curwin = x(st:en,:).*repmat(datawin,1,Nsignals);
feat(i,:) = sum(abs(curwin));
st = st + wininc;
en = en + wininc;
end
if dispstatus
close(h)
end