MAP_Gait_Dynamics/msentropy.m

28 lines
1019 B
Matlab
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

% Function for calculating multiscale entropy
% input: signal
% m: match point(s)
% r: matching tolerance
% factor: number of scale factor
% sampenc is available at http://people.ece.cornell.edu/land/PROJECTS/Complexity/sampenc.m
%
% Multi-scale sample Entropy (Mscale-En) is an indicator of gait predictability. Multi-scale entropy takes the
% complexity of a system into account by calculating the
% predictability of a signal over time scales with increasing
% length. A coarse-graining process is applied to the acceleration signals; non-overlapping windows of data
% points with an increasing length τ are constructed, with
% τ representing the time scale with a tolerance of r (in the
% present study τ = 7 and r = 0.2). A complete predictable
% signal will adopt a Mscale-En value of 0 [29].
function e = msentropy(input,m,r,factor)
y=input;
y=y-mean(y);
y=y/std(y);
for i=1:factor
s=coarsegraining(y,i); % dont have this function yet.
sampe=sampenc(s,m+1,r);
e(i)=sampe(m+1);
end
e=e';