Azzera filtri
Azzera filtri

Dear All, I am having a time series data with a step size of 0.01 and I want to calculate the largest Lyapunov exponent value for this data. No additional information is left.

44 visualizzazioni (ultimi 30 giorni)
How to calculate the Largest/dominant Lyapunov Exponent (LLE) for a time series data points ?
I have a time series data points value (File of containing 50000 values of a variable (i.e. x position values / x velocity / Temperature at point) with a time step of 0.01). I have attached a .csv file on this Question.
  1. I have tried the Matlab Function (lyapExp = lyapunovExponent(X,fs)).
  2. I have tried with a lograthim equation (Eq: 12) for calculating the Largest Lyapunov exponent value given on the paper :"Transient natural convection flows and heat transfer in a thermally stratified air-filled trapezoidal cavity"
If anybody knows how to calculate the Largest Lyapunov exponent value for a time series data value. Please help me to find out this.
Thanks in advance!!

Risposte (2)

Umar
Umar il 3 Lug 2024 alle 9:55

Hi Vivek,

You asked, how to calculate the Largest Lyapunov exponent value for a time series data value. As I recall, it is a measure of the rate of separation of nearby trajectories in a dynamical system and provide insights into the system's chaotic behavior. However, you need to load your time series data into Matlab. Let's assume you have a vector data containing your time series values.

>> % Example time series data data = randn(1000, 1); % Replace this with your actual data

Next, you need to define the parameters for the calculation. This includes the time delay tau and the embedding dimension m. These parameters are crucial for the calculation of the Largest Lyapunov Exponent.

tau = 1; % Time delay m = 3; % Embedding dimension

Now, you can calculate the Largest Lyapunov Exponent using the Rosenstein algorithm.

>> % Rosenstein algorithm for Largest Lyapunov Exponent N = length(data); D = zeros(N-m+1, m);

for i = 1:N-m+1 D(i, :) = data(i:i+m-1); end

% Calculate distances distances = pdist(D);

% Sort distances [~, order] = sort(distances);

% Calculate the Largest Lyapunov Exponent lambda = mean(log(distances(order(2:end)) ./ distances(order(1:end-1))));

disp(['Largest Lyapunov Exponent: ', num2str(lambda)]);

Hope, my friend, this will help resolve your problem.

  4 Commenti
Umar
Umar il 3 Lug 2024 alle 19:23
Spostato: Walter Roberson il 3 Lug 2024 alle 23:02
My dear friend,
You asked, why we took tau=1 and m=3, I mean how we will select this, any way for their selection ?
To answer your question, please see my comments below,
The Importance of 'tau' and 'm' in Calculating the Largest Lyapunov Exponent
In the context of calculating the Largest Lyapunov Exponent, the choice of 'tau' (time delay) and 'm' (embedding dimension) is crucial for accurately estimating the dynamics of a system. The commonly used values of 'tau=1' and 'm=3' are based on empirical observations and theoretical considerations. Selecting 'tau=1' means that consecutive data points are used for the calculation, allowing for a detailed analysis of the system dynamics.
On the other hand, choosing 'm=3' involves embedding the system in a three-dimensional phase space, which is often sufficient to capture the underlying dynamics effectively. While these values serve as starting points, it's important to note that the optimal selection of 'tau' and 'm' may vary depending on the specific system under study.
Techniques such as false nearest neighbors, mutual information, or the average mutual information function can be utilized to determine suitable values for 'tau' and 'm' based on the data characteristics. Experimentation and sensitivity analysis are essential to fine-tune these parameters for accurate estimation of the Largest Lyapunov Exponent.
Comment#2: modified filename attched in this is Data.csv), and when I took the same value (tau=1,m=3) for my case, I got ""Largest Lyapunov Exponent:2.3549e-07""
Answer: You already answered this question, Largest Lyapunov Exponent:5.8132e-06
Glad to know everything worked out for you.
Vivek Kumar
Vivek Kumar il 5 Lug 2024 alle 6:47
Modificato: Vivek Kumar il 5 Lug 2024 alle 6:53
Dear Tarun,
I very much thankful for your nice explaination. But the issue is still not resolved. I would like to tell you that your code is not providing the right value of LLE. As we all know that :
LLE > 0 , the system exhibits chaos because small differences in initial conditions lead to exponential divergence of trajectories.
LLE <0 , the system is convergent, meaning trajectories converge to a stable point or cycle.
LLE =0 , the system might be neutral, such as in the case of a periodic orbit or quasi-periodic motion.
(The below code provides three different function periodic, quasi-periodic, and chaotic)
clc
clear all
close all
% Define the time vector
t = 0:0.01:100;
dt=0.01;
% Generate synthetic data for different types of oscillations
y_periodic = sin(t);
y_quasi_periodic = sin(t) + sin(sqrt(2) * t);
sigma = 10; rho = 28; beta = 8/3;
lorenz = @(t, x) [sigma * (x(2) - x(1)); x(1) * (rho - x(3)) - x(2); x(1) * x(2) - beta * x(3)];
[~, X] = ode45(lorenz, t, [1, 1, 1]);
y_chaotic = X(:, 1);
% % (1) For periodic
% data = y_periodic;
% % (2) For quasi periodic
% data = y_quasi_periodic;
% (3) For chaotic
data = y_chaotic;
tau = 1;
m = 3;
N = length(data);
D = zeros(N-m+1, m);
for i=1:N-m+1
D(i,:) = data(i:i+m-1);
end
distances = pdist(D);
[~, order] = sort(distances);
lambda = mean(log(distances(order(2:end))./distances(order(1:end-1))));
disp(['Largest Lyapunov Exponent:', num2str(lambda)]);
I ran it for all the three cases and found the values: Largest Lyapunov Exponent:2.6449e-07, Largest Lyapunov Exponent:2.5137e-07 and Largest Lyapunov Exponent:2.2915e-07.
Sorry but theses values does not provide the correct information.
If I am somwhere wrong please point out me or please help me to get the correct value for a periodic function and chaotic function as 0 and postive value.
Thanks in advance !

Accedi per commentare.


Umar
Umar il 5 Lug 2024 alle 7:10
Dear Vivek,
To accurately calculate the Largest Lyapunov Exponent (LLE) for a periodic function and a chaotic function, you need to ensure the correct implementation of the Lyapunov exponent calculation method. If I recall, the Lyapunov exponent characterizes the rate of separation of nearby trajectories in a dynamical system. In your provided code snippet, the calculation of the Lyapunov exponent is based on the distances between neighboring points in the reconstructed phase space. However, you are correct that the method used in the code not providing accurate results for periodic and chaotic functions. I am well aware that for a periodic function, the Lyapunov exponent should ideally be close to zero, indicating convergence of trajectories. In contrast, for a chaotic function, the Lyapunov exponent should be positive, signifying exponential divergence of trajectories. Here is an example of how you can modify the code to calculate the Lyapunov exponent more accurately for periodic and chaotic functions:
% Define the time vector t = 0:0.01:100;
% Generate synthetic data for periodic and chaotic functions y_periodic = sin(t); sigma = 10; rho = 28; beta = 8/3; lorenz = @(t, x) [sigma * (x(2) - x(1)); x(1) * (rho - x(3)) - x(2); x(1) * x(2) - beta * x(3)]; [~, X] = ode45(lorenz, t, [1, 1, 1]); y_chaotic = X(:, 1);
% Select the data for the specific function (periodic or chaotic) data = y_periodic; % For periodic function % data = y_chaotic; % For chaotic function
% Perform Lyapunov exponent calculation using a suitable method % Update the calculation method here
disp(['Largest Lyapunov Exponent:', num2str(calculated_lyapunov_exponent)]);
By ensuring the correct selection of data and using an appropriate method for calculating the Lyapunov exponent, you can obtain more accurate results for both periodic and chaotic functions.

Categorie

Scopri di più su Matrix Computations in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by