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

简介: 基于顺序模式的度量的多元时间序列非线性分析的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电子书和数学建模资料


相关文章
|
27天前
|
存储 传感器 分布式计算
针对大尺度L1范数优化问题的MATLAB工具箱推荐与实现
针对大尺度L1范数优化问题的MATLAB工具箱推荐与实现
|
27天前
|
新能源 Java Go
【EI复现】参与调峰的储能系统配置方案及经济性分析(Matlab代码实现)
【EI复现】参与调峰的储能系统配置方案及经济性分析(Matlab代码实现)
|
28天前
|
机器学习/深度学习 编解码 运维
MATLAB高阶谱分析工具箱(HOSA)解析
MATLAB高阶谱分析工具箱(HOSA)解析
|
2月前
|
数据采集 算法 前端开发
MATLAB|基于3D FDTD的微带线馈矩形天线分析[用于模拟超宽带脉冲通过线馈矩形天线的传播,以计算微带结构的回波损耗参数]
MATLAB|基于3D FDTD的微带线馈矩形天线分析[用于模拟超宽带脉冲通过线馈矩形天线的传播,以计算微带结构的回波损耗参数]
139 2
|
2月前
|
机器学习/深度学习 传感器 算法
【无人车路径跟踪】基于神经网络的数据驱动迭代学习控制(ILC)算法,用于具有未知模型和重复任务的非线性单输入单输出(SISO)离散时间系统的无人车的路径跟踪(Matlab代码实现)
【无人车路径跟踪】基于神经网络的数据驱动迭代学习控制(ILC)算法,用于具有未知模型和重复任务的非线性单输入单输出(SISO)离散时间系统的无人车的路径跟踪(Matlab代码实现)
179 2
|
2月前
|
机器学习/深度学习 算法 决策智能
MATLAB中双馈发电机与无刷双馈发电机低电压穿越的异同分析
MATLAB中双馈发电机与无刷双馈发电机低电压穿越的异同分析
|
2月前
|
机器学习/深度学习 数据采集 并行计算
基于DTW(动态弯曲距离)-Kmeans的时间序列聚类分析模型(Matlab代码实现)
基于DTW(动态弯曲距离)-Kmeans的时间序列聚类分析模型(Matlab代码实现)
276 1
|
2月前
|
存储 边缘计算 算法
【太阳能学报EI复现】基于粒子群优化算法的风-水电联合优化运行分析(Matlab代码实现)
【太阳能学报EI复现】基于粒子群优化算法的风-水电联合优化运行分析(Matlab代码实现)
|
27天前
|
机器学习/深度学习 算法 机器人
【水下图像增强融合算法】基于融合的水下图像与视频增强研究(Matlab代码实现)
【水下图像增强融合算法】基于融合的水下图像与视频增强研究(Matlab代码实现)
162 0
|
27天前
|
算法 定位技术 计算机视觉
【水下图像增强】基于波长补偿与去雾的水下图像增强研究(Matlab代码实现)
【水下图像增强】基于波长补偿与去雾的水下图像增强研究(Matlab代码实现)

热门文章

最新文章