MSE——matlab代码
符号说明:
x-输入信号矢量(如脑电信号或声音信号)
nSf-比例因子的数量
m-模板长度(历元长度);Costa使用m=2
r-匹配阈值;通常选择在
时间序列的样本偏差;当x经过z变换时:将公差定义为r乘以标准偏差
mse-多尺度熵
sf-与mse相对应的比例因子
解释:Costa解释了更高的熵值以反映更多在这个尺度上的信息(如果是随机的,则不太可预测)。在天平上相当稳定。
参考文献:
Costa等人。(2002)复杂生理学的多尺度熵分析时间序列。
Costa等人。(2005)生物信号的多尺度熵分析。
MSE_Costa2005
function [mse sf] = MSE_Costa2005(x,nSf,m,r)
% pre-allocate mse vector
mse = zeros([1 nSf]);
% coarse-grain and calculate sample entropy for each scale factor
for ii = 1 : nSf
% get filter weights
f = ones([1 ii]);
f = f/sum(f);
% get coarse-grained time series (i.e., average data within non-overlapping time windows)
y = filter(f,1,x);
y = y(length(f):end);
y = y(1:length(f):end);
% calculate sample entropy
mse(ii) = SampleEntropy(y,m,r,0);
end
% get sacle factors
sf = 1 : nSf;
colored_noise
function [y] = colored_noise(Sf,dur,b)
% [y] = colored_noise(Sf,dur,b)
%
% Sf - sampling frequency
% dur - duration
% b - exponent of the 1/f^b power law function
% b = 0 (white), 1 (pink), 2 (brown), -1 (blue), -2 (violet)
%
% y - noise time domain signal
% (y is normalized such that mean(y)==0 and std(y)==1)
%
% Description: The script calcula