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


相关文章
|
29天前
|
算法 数据可视化
基于SSA奇异谱分析算法的时间序列趋势线提取matlab仿真
奇异谱分析(SSA)是一种基于奇异值分解(SVD)和轨迹矩阵的非线性、非参数时间序列分析方法,适用于提取趋势、周期性和噪声成分。本项目使用MATLAB 2022a版本实现从强干扰序列中提取趋势线,并通过可视化展示了原时间序列与提取的趋势分量。代码实现了滑动窗口下的奇异值分解和分组重构,适用于非线性和非平稳时间序列分析。此方法在气候变化、金融市场和生物医学信号处理等领域有广泛应用。
|
28天前
|
监控 算法 数据安全/隐私保护
基于视觉工具箱和背景差法的行人检测,行走轨迹跟踪,人员行走习惯统计matlab仿真
该算法基于Matlab 2022a,利用视觉工具箱和背景差法实现行人检测与轨迹跟踪,通过构建背景模型(如GMM),对比当前帧与模型差异,识别运动物体并统计行走习惯,包括轨迹、速度及停留时间等特征。演示三维图中幅度越大代表更常走的路线。完整代码含中文注释及操作视频。
|
2月前
|
安全
【2023高教社杯】D题 圈养湖羊的空间利用率 问题分析、数学模型及MATLAB代码
本文介绍了2023年高教社杯数学建模竞赛D题的圈养湖羊空间利用率问题,包括问题分析、数学模型建立和MATLAB代码实现,旨在优化养殖场的生产计划和空间利用效率。
123 6
【2023高教社杯】D题 圈养湖羊的空间利用率 问题分析、数学模型及MATLAB代码
|
1月前
|
算法 数据可视化 数据安全/隐私保护
基于LK光流提取算法的图像序列晃动程度计算matlab仿真
该算法基于Lucas-Kanade光流方法,用于计算图像序列的晃动程度。通过计算相邻帧间的光流场并定义晃动程度指标(如RMS),可量化图像晃动。此版本适用于Matlab 2022a,提供详细中文注释与操作视频。完整代码无水印。
|
17天前
|
机器学习/深度学习 算法 数据安全/隐私保护
基于PSO粒子群优化的GroupCNN分组卷积网络时间序列预测算法matlab仿真
本项目展示了一种结合粒子群优化(PSO)与分组卷积神经网络(GroupCNN)的时间序列预测算法。该算法通过PSO寻找最优网络结构和超参数,提高预测准确性与效率。软件基于MATLAB 2022a,提供完整代码及详细中文注释,并附带操作步骤视频。分组卷积有效降低了计算成本,而PSO则智能调整网络参数。此方法特别适用于金融市场预测和天气预报等场景。
|
23天前
|
机器学习/深度学习 算法 数据挖掘
基于GWO灰狼优化的CNN-LSTM的时间序列回归预测matlab仿真
本项目展示了一种结合灰狼优化(GWO)与深度学习模型(CNN和LSTM)的时间序列预测方法。GWO算法高效优化模型超参数,提升预测精度。CNN提取局部特征,LSTM处理长序列依赖,共同实现准确的未来数值预测。项目包括MATLAB 2022a环境下运行的完整代码及视频教程,代码内含详细中文注释,便于理解和操作。
|
2月前
|
机器学习/深度学习 算法 数据挖掘
基于WOA优化的CNN-LSTM的时间序列回归预测matlab仿真
本项目采用MATLAB 2022a实现时间序列预测,利用CNN与LSTM结合的优势,并以鲸鱼优化算法(WOA)优化模型超参数。CNN提取时间序列的局部特征,LSTM处理长期依赖关系,而WOA确保参数最优配置以提高预测准确性。完整代码附带中文注释及操作指南,运行效果无水印展示。
|
2月前
|
机器学习/深度学习 算法 数据挖掘
基于GWO灰狼优化的CNN-GRU的时间序列回归预测matlab仿真
时间序列预测关键在于有效利用历史数据预测未来值。本研究采用卷积神经网络(CNN)提取时间序列特征,结合GRU处理序列依赖性,并用灰狼优化(GWO)精调模型参数。CNN通过卷积与池化层提取数据特征,GRU通过更新门和重置门机制有效管理长期依赖。GWO模拟灰狼社群行为进行全局优化,提升预测准确性。本项目使用MATLAB 2022a实现,含详细中文注释及操作视频教程。
|
2月前
|
机器学习/深度学习 算法 数据挖掘
基于WOA优化的CNN-GRU的时间序列回归预测matlab仿真
本项目运用鲸鱼优化算法(WOA)优化卷积神经网络(CNN)与GRU网络的超参数,以提升时间序列预测精度。在MATLAB 2022a环境下,通过CNN提取时间序列的局部特征,而GRU则记忆长期依赖。WOA确保模型参数最优配置。代码附有中文注释及操作视频,便于理解和应用。效果预览无水印,直观展示预测准确性。
|
2月前
|
数据采集 存储 移动开发
【2023五一杯数学建模】 B题 快递需求分析问题 建模方案及MATLAB实现代码
本文介绍了2023年五一杯数学建模竞赛B题的解题方法,详细阐述了如何通过数学建模和MATLAB编程来分析快递需求、预测运输数量、优化运输成本,并估计固定和非固定需求,提供了完整的建模方案和代码实现。
71 0
【2023五一杯数学建模】 B题 快递需求分析问题 建模方案及MATLAB实现代码

热门文章

最新文章

下一篇
无影云桌面