0
点赞
收藏
分享

微信扫一扫

基于顺序模式的度量的多元时间序列非线性分析的Matlab工具箱代码

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

​​智能优化算法​​​       ​​神经网络预测​​​       ​​雷达通信 ​​​      ​​无线传感器​​​        ​​电力系统​​

​​信号处理​​​              ​​图像处理​​​               ​​路径规划​​​       ​​元胞自动机​​​        ​​无人机 ​​

⛄ 内容介绍

OPA(序数模式分析)工具箱用于多元时间序列的非线性分析,基于序数模式的度量变得越来越流行 [1-5],这些度量可以高效计算 [6,7] 并可视化:- 
排列entropy (cfg.method = 'PE') [2] 
- 具有并列等级的序数模式的排列熵 (cfg.method = 'eqPE') [4,8] 
- 排列熵和序数模式分布 (cfg.method = 'opdPE ') [3] 
- 序数模式的条件熵 (cfg.method = 'cePE') [6] 
- 稳健的排列熵 (cfg.method = 'rePE') [4,7] 

⛄ 部分代码


%% compute permutation entropy in sliding windows

load( 'tonicClonic.mat' );

cfg            = [];

cfg.method     = 'PE'; % compute permutation entropy

cfg.order      = 3;    % ordinal pattens of order 3 (4-points ordinal patterns)

cfg.delay      = 2;    % delay 2 between points in ordinal patterns 

                       % (one point between successive points in ordinal patterns)

cfg.windowSize = 512;  % window size = 512 time steps

cfg.time       = 0:1/102.4:179.999; % OPTIONAL time axis for plotting

cfg.units      = 'seconds';         % OPTIONAL units of time for plotting

outdata        = OPanalysis( cfg, indata );


%% compute permutation entropy and ordinal distributions in sliding windows

load( 'tonicClonic.mat' );

cfg            = [];

cfg.method     = 'opdPE'; % compute permutation entropy

cfg.order      = 3;       % ordinal pattens of order 3 (4-points ordinal patterns)

cfg.orderSeq   = 6;       % ordinal pattens of order 6 for plotting their sequence (7-points ordinal patterns)

cfg.delay      = 1;       % delay 1 between points in ordinal patterns (successive points)

cfg.windowSize = 1024;    % window size = 1024 time steps

cfg.time       = 0:1/102.4:179.999; % OPTIONAL time axis for plotting

cfg.units      = 'seconds';         % OPTIONAL units of time for plotting

outdata        = OPanalysis( cfg, indata );


%% compute all the implemented measures simultaneously for comparison

load( 'tonicClonic.mat' );

cfg                = [];

cfg.method         = 'all';  % compute all implemented ordinal-patterns-based measures

cfg.order          = 4;      % ordinal patterns of order 4 (5-points ordinal patterns)

cfg.delay          = 1;      % delay 1 between points in ordinal patterns

cfg.windowSize     = 512;    % window size = 512 time steps

cfg.lowerThreshold = 0.2;    % the distance considered negligible between points

cfg.upperThreshold = 200;    % the distance between points most probably related to artifact

cfg.time           = 0:1/102.4:179.999; % OPTIONAL time axis for plotting

cfg.units          = 'seconds';         % OPTIONAL units of time for plotting

outdata            = OPanalysis( cfg, indata );


%% compute conditional entropy of ordinal patterns in sliding windows

load( 'tonicClonic.mat' );

cfg            = [];

cfg.method     = 'CE'; % we compute conditional entropy of ordinal patterns

cfg.order      = 3;    % ordinal pattens of order 3 (4-points ordinal patterns)

cfg.delay      = 1;    % delay 1 between points in ordinal patterns (successive points)

cfg.windowSize = 512;  % window size = 512 time steps

cfg.time       = 0:1/102.4:179.999; % OPTIONAL time axis for plotting

cfg.units      = 'seconds';         % OPTIONAL units of time for plotting

outdata        = OPanalysis( cfg, indata );


%% compute robust permutation entropy

load( 'tonicClonic.mat' );

cfg                = [];

cfg.method         = 'rePE'; % compute robust permutation entropy

cfg.order          = 6;      % ordinal patterns of order 6 (7-points ordinal patterns)

cfg.delay          = 1;      % delay 1 between points in ordinal patterns

cfg.windowSize     = 2048;   % window size = 2048 time steps

cfg.lowerThreshold = 0.2;    % the distance that is considered negligible between points

cfg.upperThreshold = 100;    % the distance between points most probably related to artifact

cfg.time           = 0:1/102.4:179.999; % OPTIONAL time axis for plotting

cfg.units          = 'seconds';         % OPTIONAL units of time for plotting

outdata            = OPanalysis( cfg, indata );


%% compute permutation entropy for ordinal patterns with tied ranks in sliding windows

load( 'tonicClonic.mat' );

cfg            = [];

cfg.method     = 'PEeq'; % compute permutation entropy for ordinal patterns with tied ranks

cfg.order      = 3;      % ordinal pattens of order 3 (4-points ordinal patterns)

cfg.delay      = 3;      % delay 3 between points in ordinal patterns 

                         % (2 points between successive points in ordinal patterns)

cfg.windowSize = 1024;   % window size = 1024 time steps

cfg.time       = 0:1/102.4:179.999; % OPTIONAL time axis for plotting

cfg.units      = 'seconds';         % OPTIONAL units of time for plotting

outdata        = OPanalysis( cfg, indata );


%% compute permutation entropy for several channels

load( 'tonicClonic.mat' );

indata( 2, : )     = rand( 1, length( indata ) );  

cfg                = [];

cfg.method         = 'PE'; % compute robust permutation entropy

cfg.order          = 3;      % ordinal patterns of order 3 (4-points ordinal patterns)

cfg.delay          = 1;      % delay 1 between points in ordinal patterns

cfg.windowSize     = 1024;   % window size = 1024 time steps

cfg.time           = 0:1/102.4:179.999; % OPTIONAL time axis for plotting

cfg.units          = 'seconds';         % OPTIONAL units of time for plotting

outdata            = OPanalysis( cfg, indata );


%% compute permutation entropy and conditional entropy of ordinal patterns 

% for different parameters of logistic map (we use low-level functions for the example)

orbitLength = 10^4;

% take different r values 

order       = 7;    % for ordinal pattens of order 7 (8-points ordinal patterns)

delay       = 1;    % for delay 1 (successive points in ordinal patterns)

windowSize  = orbitLength - order*delay;

r           = 3.5:5*10^(-4):4; 

peValues    = zeros( 1, length( r ) );

ceValues    = zeros( 1, length( r ) );

leValues    = LEofLogisticMap( 3.5, 4, 5*10^(-4) );

indata      = zeros( 1, orbitLength );

for i = 1:length( r )

  if ( rem( i, 10 ) == 0 )

    disp( [ 'Calculating entropies for r = ' num2str( r( i ) ) ' from 4' ] );

  end

  indata( 1, 1 ) = rand( 1, 1 );

  for j = 2:orbitLength

    indata( j ) = r( i )*indata( j - 1 )*( 1 - indata( j - 1 ) );

  end

  peValues( i ) = PE( indata, delay, order, windowSize );

  ceValues( i ) = CondEn( indata, delay, order, windowSize - delay );

end

figure;

linewidth  = 0.5;

markerSize = 2;

plot( r, leValues, 'k',  'LineWidth',  linewidth ); grid on; hold on;

plot( r, peValues, 'go', 'markerSize', markerSize ); grid on; hold on;

plot( r, ceValues, 'bo', 'markerSize', markerSize ); grid on; hold on;

legend( 'LE', 'PE', 'CE' );

xlabel( 'Values of parameter r for logistic map x(t)=r*x(t-1)*(1-x(t-1))' ); 


%% INEFFICIENT METHOD: compute permutation entropy in sliding windows with an old method

% just for comparison in terms of speed with fast (PE.m) method

load( 'tonicClonic.mat' );

cfg            = [];

cfg.method     = 'oldPE'; % compute permutation entropy

cfg.order      = 6;       % ordinal pattens of order 6 (7-points ordinal patterns)

cfg.delay      = 1;       % delay 1 between points in ordinal patterns (successive points)

cfg.windowSize = 512;     % window size = 512 time steps

cfg.time       = 0:1/102.4:179.999; % OPTIONAL time axis for plotting

cfg.units      = 'seconds';         % OPTIONAL units of time for plotting

outdata        = OPanalysis( cfg, indata );

⛄ 运行结果

基于顺序模式的度量的多元时间序列非线性分析的Matlab工具箱代码_无人机

基于顺序模式的度量的多元时间序列非线性分析的Matlab工具箱代码_无人机_02

基于顺序模式的度量的多元时间序列非线性分析的Matlab工具箱代码_无人机_03

⛄ 参考文献

REFERENCES: 
[1] Amigo, J.M., Keller, K. and Unakafova, V.A., 2015. On entropy, entropy-like quantities, and applications. Discrete & Continuous Dynamical Systems-Series B, 20(10). 
[2] Bandt C., Pompe B., Permutation entropy: a natural complexity measure for time series. Physical review letters, 2002, APS 
[3] Keller, K., and M. Sinn. Ordinal analysis of time series. Physica A: Statistical Mechanics and its Applications 356.1 (2005): 114--120 
[4] Keller, K., Unakafov, A.M. and Unakafova, V.A., 2014. Ordinal patterns, entropy, and EEG. Entropy, 16(12), pp.6212-6239. 
[5] Zanin, M., Zunino, L., Rosso, O.A. and Papo, D., 2012. 
Permutation entropy and its main biomedical and econophysics applications: a review. Entropy, 14(8), pp.1553-1577. 
[6] Unakafova, V.A., Keller, K., 2013. Efficiently measuring complexity on the basis of real-world Data. Entropy, 15(10), 4392-4415. 
[7] Unakafova, V.A., 2015. Investigating measures of complexity for dynamical systems and for time series (Doctoral dissertation, University of Luebeck). 
[8] Bian, C., Qin, C., Ma, Q.D. and Shen, Q., 2012. Modified permutation-entropy analysis of heartbeat dynamics. Physical Review E, 85(2), p.021906. 
[9] Amigo, J.M., Zambrano, S. and Sanjuan, M.A., 2008. Combinatorial detection of determinism in noisy time series. EPL (Europhysics Letters), 83(6), p.60005. 
[10] Cao, Y., Tung, W.W., Gao, J.B. et al., 2004. Detecting dynamical changes in time series using the permutation entropy. Physical Review E, 70(4), p.046217. 
[11] Riedl, M., Muller, A. and Wessel, N., 2013. Practical considerations of permutation entropy. The European Physical Journal Special Topics, 222(2), pp.249-262

⛳️ 完整代码

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料


举报

相关推荐

MATLAB中cvx工具箱的使用

matlab机器人工具箱的使用(3)

0 条评论