基于顺序模式的度量的多元时间序列非线性分析的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 );

⛄ 运行结果

⛄ 参考文献

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电子书和数学建模资料

1 2/3维图像分割工具箱 2 PSORT粒子群优化工具箱 3 matlab计量工具箱Lesage 4 MatCont7p1 5 matlab模糊逻辑工具箱函数 6 医学图像处理工具箱 7 人工蜂群工具箱 8 MPT3安装包 9 drEEM toolbox 10 DOMFluor Toolbox v1.7 11 Matlab数学建模工具箱 12 马尔可夫决策过程(MDP)工具箱MDPtoolbox 13 国立SVM工具箱 14 模式识别与机器学习工具箱 15 ttsbox1.1语音合成工具箱 16 分数阶傅里叶变换的程序FRFT 17 魔方模拟器与规划求解 18 隐马尔可夫模型工具箱 HMM 19 图理论工具箱GrTheory 20 自由曲线拟合工具箱ezyfit 21 分形维数计算工具箱FracLab 2.2 22 For-Each 23 PlotPub 24 Sheffield大学最新遗传算法工具箱 25 Camera Calibration 像机标定工具箱 26 Qhull(二维三维三角分解、泰森图)凸包工具箱 2019版 27 jplv7 28 MatlabFns 29 张量工具箱Tensor Toolbox 30 海洋要素计算工具箱seawater 31 地图工具箱m_map 32 othercolor配色工具包 33 Matlab数学建模工具箱 34 元胞自动机 35 量子波函数演示工具箱 36 图像局域特征匹配工具箱 37 图像分割graphcut工具箱 38 NSGA-II工具箱 39 chinamap中国地图数据工具箱(大陆地区) 40 2D GaussFit高斯拟合工具箱 41 dijkstra最小成本路径算法 42 多维数据快速矩阵乘法 43 约束粒子群优化算法 44 脑MRI肿瘤的检测与分类 45 Matlab数值分析算法程序 46 matlab车牌识别完整程序 47 机器人工具箱robot-10.3.1 48 cvx凸优化处理工具箱 49 hctsa时间序列分析工具箱 50 神经科学工具箱Psychtoolbox-3-PTB 51 地震数据处理工具CREWES1990版 52 经济最优化工具箱CompEcon 53 基于约束的重构分析工具箱Cobratoolbox 54 Schwarz-Christoffel Toolbox 55 Gibbs-SeaWater (GSW)海洋学工具箱 56 光声仿真工具箱K-Wave-toolbox-1.2.1 57 语音处理工具箱Sap-Voicebox 58 贝叶斯网工具箱Bayes Net Toolbox(BNT) 59 计算机视觉工具箱VFfeat-0.9.21 60 全向相机校准工具箱OCamCalib_v3.0 61 心理物理学数据分析工具箱Palamedes1_10_3 62 生理学研究工具箱EEGLAB 63 磁共振成像处理工具箱CONN 18b 64 matlab 复杂网络工具箱 65 聚类分析工具箱FuzzyClusteringToolbox 66 遗传规划matlab工具箱 67 粒子群优化工具箱 68 数字图像处理工具箱DIPUM Toolbax V1.1.3 69 遗传算法工具箱 70 鱼群算法工具箱OptimizedAFSAr 71 蚁群算法工具箱 72 matlab优化工具箱 73 数据包络分析工具箱 74 图像分割质量评估工具包 75 相关向量机工具箱 76 音频处理工具箱 77 nurbs工具箱 78 Nurbs-surface工具箱 79 grabit数据提取工具箱 80 量子信息工具箱QLib 81 DYNAMO工具箱 82 NEDC循环的整车油耗量 83 PlotHub工具箱 84 MvCAT_Ver02.01 85 Regularization Tools Version 4.1 86 MatrixVB 4.5(含注册) 87 空间几何工具箱 matGeom-1.2.2 88 大数计算工具箱 VariablePrecisionIntegers 89 晶体织构分析工具包 mtex-5.7.0 90 Minimal Paths 2工具箱 91 Matlab数学建模工具箱
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值