求最大李雅普诺夫指数(Largest Lyapunov Exponents,LLE)的 Rosenstein 算法

article/2025/9/22 16:42:13

文章目录

  • 原始论文
  • python 相关代码
  • 混沌系统的常见指标
  • 最大李亚普诺夫指数的含义
  • 算法流程图
  • python 代码模块
    • 最近邻
    • maximum Lyapunov exponent
    • RANSAC 拟合曲线
  • 例子:计算洛伦兹系统的最大李雅普诺夫指数

原始论文

M.T. Rosenstein, J.J. Collins, and C.J. De Luca. A practical method for calculating largest Lyapunov exponents from small data sets. Physica D, 65:117-134, 1993.

下载地址:https://www.physionet.org/content/lyapunov/1.0.0/

python 相关代码

  • NonLinear Time Series Analysis(nolitsa)
    在这里插入图片描述
  • NOnLinear measures for Dynamical Systems (nolds)
    在这里插入图片描述

混沌系统的常见指标

区分确定性混沌系统与噪声已成为许多不同领域的重要问题。

对于实验产生的时间序列,可以计算这些混沌系统的指标:

  • 相关维数( D 2 D_2 D2),
  • Kolmogorov 熵
  • Lyapunov 特征指数。

相关维度是对系统复杂程度的估计,熵和特征指数是对混沌程度的估计。

最大李亚普诺夫指数的含义

LLE 描述了相空间中相近的两点(初始间距为 C C C)随时间推移指数分离的速率:
d ( t ) = C e λ 1 t d(t) = Ce^{\lambda_1 t} d(t)=Ceλ1t其中 d ( t ) d(t) d(t)表示分离距离, C C C表示初始间距, λ 1 \lambda_1 λ1 为最大李氏指数。

算法流程图

在这里插入图片描述

python 代码模块

最近邻

import numpy as npfrom scipy import stats
from scipy.spatial import cKDTree as KDTree
from scipy.spatial import distancedef neighbors(y, metric='chebyshev', window=0, maxnum=None):"""Find nearest neighbors of all points in the given array.Finds the nearest neighbors of all points in the given array usingSciPy's KDTree search.Parameters----------y : ndarrayN-dimensional array containing time-delayed vectors.metric : string, optional (default = 'chebyshev')Metric to use for distance computation.  Must be one of"cityblock" (aka the Manhattan metric), "chebyshev" (aka themaximum norm metric), or "euclidean".window : int, optional (default = 0)Minimum temporal separation (Theiler window) that should existbetween near neighbors.  This is crucial while computingLyapunov exponents and the correlation dimension.maxnum : int, optional (default = None (optimum))Maximum number of near neighbors that should be found for eachpoint.  In rare cases, when there are no neighbors that are at anonzero distance, this will have to be increased (i.e., beyond2 * window + 3).Returns-------index : arrayArray containing indices of near neighbors.dist : arrayArray containing near neighbor distances."""if metric == 'cityblock':p = 1elif metric == 'euclidean':p = 2elif metric == 'chebyshev':p = np.infelse:raise ValueError('Unknown metric.  Should be one of "cityblock", ''"euclidean", or "chebyshev".')tree = KDTree(y)n = len(y)if not maxnum:maxnum = (window + 1) + 1 + (window + 1)else:maxnum = max(1, maxnum)if maxnum >= n:raise ValueError('maxnum is bigger than array length.')dists = np.empty(n)indices = np.empty(n, dtype=int)for i, x in enumerate(y):for k in range(2, maxnum + 2):dist, index = tree.query(x, k=k, p=p)valid = (np.abs(index - i) > window) & (dist > 0)if np.count_nonzero(valid):dists[i] = dist[valid][0]indices[i] = index[valid][0]breakif k == (maxnum + 1):raise Exception('Could not find any near neighbor with a ''nonzero distance.  Try increasing the ''value of maxnum.')return np.squeeze(indices), np.squeeze(dists)

maximum Lyapunov exponent

def mle(y, maxt=500, window=10, metric='euclidean', maxnum=None):"""Estimate the maximum Lyapunov exponent.Estimates the maximum Lyapunov exponent (MLE) from amulti-dimensional series using the algorithm described byRosenstein et al. (1993).Parameters----------y : ndarrayMulti-dimensional real input array containing points in thephase space.maxt : int, optional (default = 500)Maximum time (iterations) up to which the average divergenceshould be computed.window : int, optional (default = 10)Minimum temporal separation (Theiler window) that should existbetween near neighbors (see Notes).maxnum : int, optional (default = None (optimum))Maximum number of near neighbors that should be found for eachpoint.  In rare cases, when there are no neighbors that are at anonzero distance, this will have to be increased (i.e., beyond2 * window + 3).Returns-------d : arrayAverage divergence for each time up to maxt.Notes-----This function does not directly estimate the MLE.  The MLE should beestimated by linearly fitting the average divergence (i.e., theaverage of the logarithms of near-neighbor distances) with time.It is also important to choose an appropriate Theiler window so thatthe near neighbors do not lie on the same trajectory, in which casethe estimated MLE will always be close to zero."""index, dist = utils.neighbors(y, metric=metric, window=window,maxnum=maxnum)m = len(y)maxt = min(m - window - 1, maxt)d = np.empty(maxt)d[0] = np.mean(np.log(dist))for t in range(1, maxt):t1 = np.arange(t, m)t2 = index[:-t] + t# Sometimes the nearest point would be farther than (m - maxt)# in time.  Such trajectories needs to be omitted.valid = t2 < mt1, t2 = t1[valid], t2[valid]d[t] = np.mean(np.log(utils.dist(y[t1], y[t2], metric=metric)))return d

RANSAC 拟合曲线

需要先安装 sklearn 库

def poly_fit(x, y, degree, fit="RANSAC"):# check if we can use RANSACif fit == "RANSAC":try:# ignore ImportWarnings in sklearnwith warnings.catch_warnings():warnings.simplefilter("ignore", ImportWarning)import sklearn.linear_model as sklinimport sklearn.preprocessing as skpreexcept ImportError:warnings.warn("fitting mode 'RANSAC' requires the package sklearn, using"+ " 'poly' instead",RuntimeWarning)fit = "poly"if fit == "poly":return np.polyfit(x, y, degree)elif fit == "RANSAC":model = sklin.RANSACRegressor(sklin.LinearRegression(fit_intercept=False))xdat = np.asarray(x)if len(xdat.shape) == 1:# interpret 1d-array as list of len(x) samples instead of# one sample of length len(x)xdat = xdat.reshape(-1, 1)polydat = skpre.PolynomialFeatures(degree).fit_transform(xdat)try:model.fit(polydat, y)coef = model.estimator_.coef_[::-1]except ValueError:warnings.warn("RANSAC did not reach consensus, "+ "using numpy's polyfit",RuntimeWarning)coef = np.polyfit(x, y, degree)return coefelse:raise ValueError("invalid fitting mode ({})".format(fit))

例子:计算洛伦兹系统的最大李雅普诺夫指数

在这里插入图片描述

import warnings
from nolitsa import data, lyapunov
import numpy as np
import matplotlib.pyplot as pltdt = 0.01
x0 = [0.62225717, -0.08232857, 30.60845379]
x = data.lorenz(length=4000, sample=dt, x0=x0,sigma=16.0, beta=4.0, rho=45.92)[1]
plt.plot(range(len(x)),x)
plt.show()# Choose appropriate Theiler window.
meanperiod = 30
maxt = 250
d = lyapunov.mle(x, maxt=maxt, window=meanperiod)
t = np.arange(maxt) *dt
coefs = poly_fit(t, d, 1)
print('LLE = ', coefs[0])plt.title('Maximum Lyapunov exponent for the Lorenz system')
plt.xlabel(r'Time $t$')
plt.ylabel(r'Average divergence $\langle d_i(t) \rangle$')
plt.plot(t, d, label='divergence')
plt.plot(t, t * 1.50, '--', label='slope=1.5')
plt.plot(t, coefs[1] +coefs[0]* t, '--', label='RANSAC')
plt.legend()
plt.show()

http://chatgpt.dhexx.cn/article/kGlcqsyu.shtml

相关文章

李雅普诺夫稳定性

在数学和自动控制领域中&#xff0c;李雅普诺夫稳定性&#xff08;英语&#xff1a;Lyapunov stability&#xff0c;或李亚普诺夫稳定性&#xff09;可用来描述一个动力系统的稳定性。如果此动力系统任何初始条件在 {\displaystyle x_{0}}转存失败重新上传取消 附近的轨迹均能维…

现代控制理论——李雅普诺夫第一方法

李雅普诺夫关于系统的稳定性的方法对于线性系统和非线性系统都是适用的 李雅普诺夫关于稳定性的定义 注意&#xff1a;运动轨迹与平衡状态之间的距离小于 对于完全能观或能控的系统&#xff0c;内部稳定和外部稳定其实是等价的。

李雅普诺夫定理及条件的解释

大数定律包含几个主要的定理&#xff1a; 弱大数定理&#xff08;辛钦大数定理&#xff09;以及伯努利大数定理。独立同分布的中心极限定理。李雅普诺夫定理。利莫夫-拉普拉斯大数定理。 其中最核心的定理便是李雅普诺夫定理。但是&#xff0c;该定理的前提条件晦涩难懂&…

matlab 计算 Lorenz 系统最大李雅普诺夫指数

参考原理&#xff1a; Lyapunov 指数的计算与仿真&#xff1a;https://wenku.baidu.com/view/ae8e4f80680203d8ce2f2476.html Lorenz 系统的动力学方程 function dX Lorenz(t,X,params) a params(1); b params(2); c params(3);xX(1); yX(2); zX(3);dX zeros(3,1); d…

matlab判断李雅普诺夫稳定性

李雅普诺夫稳定性matlab仿真程序 李雅普诺夫稳定性判别有两种方法&#xff0c;直接法和间接法。直接法是求解状态方程的特征多项式&#xff0c;判断极点位置&#xff0c;全在左半平面则稳定。间接法是最常用的判断稳定性方法&#xff0c;无需求解&#xff0c;只要构造一个广义…

【李雅普诺夫方程】

文章目录 前言李雅普诺夫方程求解参考链接 前言 李雅普诺夫方程 (Lyapunov equation) 作为一种著名的矩阵方程为人所熟知&#xff0c;其在控制理论以及众多工程领域有着极为广泛的应用。 李雅普诺夫方程求解 参考链接 知乎

如何计算Lyapunov exponent spectrum?matlab计算李雅普诺夫指数

如何理解和计算Lyapunov exponent spectrum&#xff1f; 1、这是我听到最接近人话的描述。 混沌运动的基本特点是运动对初始条件极为敏感&#xff0c;两个极为靠近的初始值所产生的轨迹&#xff0c;随着时间推移将按照指数方式分离。李娜诺普指数就是描述这一现象的量。 2、 结…

Matlab求解李雅普诺夫(Lyapunov)方程

线性定常连续系统渐进稳定性的判别 Matlab中可以调用lyap函数求解P AX XA -C % 这是函数的内部定义式&#xff0c;恰好与理论定义的转置是反着的所以我们应该这样使用 P lyap(A, Q) % 一般令QI&#xff08;I指单位阵&#xff09;Matlab中可以调用eig函数解矩阵特征值 可…

李雅普诺夫理论基础(1)

一.非线性系统与平衡点 1.1非线性系统 一个简单的非线性系统一般用这样的微分方程形式描述&#xff1a; x ˙ f ( x , t ) \dot{x}f(x,t) x˙f(x,t)根据这个方程的解x(t),我们可以画出来一条曲线&#xff0c;这个曲线对应于t从0开始到无穷。 1.2自治系统与非自治系统 线性…

现代控制理论(二)李雅普诺夫稳定性分析

现代控制理论&#xff08;二&#xff09;李雅普诺夫稳定性分析 一、李雅普诺夫稳定性概念1、平衡状态2、李雅普诺夫稳定性定义(通俗理解) 二、李雅普诺夫稳定性间接判别法(第一方法)三、李雅普诺夫稳定性直接判别法(第二方法)定理一&#xff1a;V(x,t)正定&#xff1b;V(x,t)负…

李雅普诺夫第二方法

0 背景和思路 **系统稳定&#xff1a;**系统储存的总能量持续地减小&#xff0c;直至耗尽&#xff0c;系统状态就会趋于平衡态 **稳定性考察&#xff1a;**考察一个正值的能量函数 V ( x ) V(\boldsymbol{x}) V(x) 和它的变化率 V ˙ ( x ) \dot{V}(\boldsymbol{x}) V˙(x)…

李雅普诺夫(第二方法)稳定性分析+例题

目录 1. 背景和思路2. 李雅普诺夫第二方法3. 李雅普诺夫稳定性分析4. 例题5. 参考文献 1. 背景和思路 系统稳定&#xff1a;系统储存的总能量持续地减小&#xff0c;直至耗尽&#xff0c;系统状态就会趋于平衡态 稳定性考察&#xff1a;考察一个正值的能量函数 V ( x ) V(x) V…

李雅普诺夫稳定性理论的理解

由于李雅普诺夫第一方法需要求解才能判断系统的稳定性&#xff0c;而大多数情况下&#xff0c;这个解是很难求出来的&#xff0c;所以便有了李雅普诺夫第二法&#xff08;直接法&#xff09;。 首先举个例子来说明直接法的基本思想。下图中小球B出在各曲面不同位置时收到微小…

李雅普诺夫梳理

预备知识&#xff1a; 矢量场、矩阵正定负定、矩阵奇异。 1.李雅普诺夫稳定的定义&#xff1a; 系统&#xff0c;在平衡状态下&#xff0c;受到扰动&#xff0c;能够&#xff0c;经过足够长时间&#xff0c;恢复到平衡的&#xff0c;一种能力&#xff1b; 2.自治系统&#x…

现代控制理论(4)——李雅普诺夫稳定性理论

文章目录 一、李雅普诺夫关于稳定性的定义1.李氏意义下的稳定2.渐近稳定3.大范围渐近稳定4.不稳定 二、李雅普诺夫第一法1.线性系统的稳定判据2.非线性系统的稳定判据 三、李雅普诺夫第二法1.标量函数的定号性2.稳定性原理 四、李雅普诺夫方法在线性系统中的应用五、李雅普诺夫…

Linux环境下的VScode使用教程

前言 &#xff08;1&#xff09;对于学习本文需要先有自行安装好VMware&#xff0c;对VMware有简单的了解。 &#xff08;2&#xff09;对于绝大多数使用Linux的人而言&#xff0c;经常在Windows环境下使用source insight进行编译程序&#xff0c;然后利用FileZilla将Windows的…

VS code开发工具的使用教程

前言 工欲善其事必先利其器&#xff0c;提高程序员的开发效率必须要有一个好的开发工具&#xff0c;当前最好的前端开发工具主要有VS code、sublime Text、Atom、Webstorm、Notepad。 VS Code 是一款十分强大的代码编辑器&#xff0c;虽然出来时间比较短&#xff0c;但是使用频…

Windows+VScode配置与使用git,超详细教程,赶紧收藏吧

目录 第一步&#xff1a;安装Git命令行工具 第二步&#xff1a;配置VScode中的git 第三步&#xff1a;使用 VScode git&#xff0c;提交到仓库 当我们在VScode中编写代码后&#xff0c;需要提交到git仓库时&#xff0c;但是我们又不想切换到git的命令行窗口&#xff0c;我们可…

vscode使用小技巧

vscode全网最详细使用教程&#xff08;让你编码快上10倍&#xff09; 一、快速编写HTML代码 初始化 HTML文档需要包含一些固定的标签&#xff0c;比如、、等&#xff0c;现在你只需要1秒钟就可以输入这些标签。比如输入“!”或“html:5”&#xff0c;然后按Tab键&#xff1a…

VSCode下载与安装使用教程【超详细讲解】

目录 一、VSCode介绍 二、官方下载地址 三、VSCode安装 1、点击我同意此协议&#xff0c;点击下一步&#xff1b; 2、点击浏览&#xff0c;选择安装路径&#xff0c;点击下一步&#xff1b; 3、添加到开始菜单&#xff0c;点击下一步&#xff1b; 4、根据需要勾选&#…