maximum Lyapunov exponent diagram
18 Comments
Hi @Noura,
To address your query, “I'm working on discrete dynamical system in 2 dimesntion t'm trying to plot a digram a paramete versus the maximum lyapunov exponent, i searched more about it but didn't reach to anything. any one have idea or could help me and thank you.”
The code snippet below simulates a dynamical system using the logistic map equation to calculate Lyapunov exponents. It computes the Lyapunov exponent for different parameter values, indicating the system's sensitivity to initial conditions. If you look at the resulting plot, it will show how the Lyapunov exponent changes concerning the system's parameters, providing insights into the system's chaotic behavior. This analysis can help you understand the system's stability and predictability based on Lyapunov exponents.
% Define your discrete dynamical system function
function x_next = dynamical_system(x, parameter)
% Define your system here, for example:
x_next = parameter * x * (1 - x);
end
% Function to calculate the Lyapunov exponent
function lyapunov = calculate_lyapunov(x, parameter, iterations)
lyapunov = 0;
for i = 1:iterations
x = dynamical_system(x, parameter);
lyapunov = lyapunov + log(abs(parameter * (1 - 2 * x)));
end
lyapunov = lyapunov / iterations;
end
% Define the range of parameter values
parameters = linspace(2.8, 4, 1000); % Adjust the range as needed
% Initialize arrays to store parameter values and corresponding Lyapunov
exponents
lyapunov_exponents = zeros(size(parameters));
% Iterate over each parameter value and calculate the Lyapunov exponent
for i = 1:length(parameters)
lyapunov_exponents(i) = calculate_lyapunov(0.5, parameters(i), 1000); %
Adjust the initial condition and iterations as needed
end
% Plot the parameter values against the maximum Lyapunov exponents
figure;
plot(parameters, lyapunov_exponents, 'b');
xlabel('Parameter Value');
ylabel('Maximum Lyapunov Exponent');
title('Parameter vs. Maximum Lyapunov Exponent Plot');
Please see attached plot.

Hope this helps answers your question.
Hi @Noura,
Please see attached results of your code regarding, “can you check what i did please if you have time and thank you.”

However, debugging and fixing your code, here is updated version, execute this code and visualize the plot. So, after visualizing plot, please tell me what is your analysis.
function [x_next, y_next] = dynamical_system(x, y, d)
x_next = 3.4*x*(1-x)-x*y;
y_next = -0.2*y+d*x*y;
end
% Define initial values for x, y, and d
x_initial = 0.5;
y_initial = 0.3;
d = 0.1;
% Call the dynamical_system function with initial values
[x_next, y_next] = dynamical_system(x_initial, y_initial, d);
% Display the results
disp('Results:');
disp(['x_next: ', num2str(x_next)]);
disp(['y_next: ', num2str(y_next)]);
function lyapunov = calculate_lyapunov(x, y, d, iterations)
lyapunov = 0;
for i = 1:iterations
[x_next, y_next] = dynamical_system(x, y, d); % Corrected function call
lyapunov = lyapunov + log(abs(d * (1 - 2 * x_next)));
x = x_next; % Update x for the next iteration
y = y_next; % Update y for the next iteration
end
lyapunov = lyapunov / iterations;
end
parameters = linspace(2.8, 4, 1000); % Adjust the range as needed
lyapunov_exponents = zeros(size(parameters));
for i = 1:length(parameters)
lyapunov_exponents(i) = calculate_lyapunov(0.5, 0.5, parameters(i), 1000);
end
figure;
plot(parameters, lyapunov_exponents, 'b');
xlabel('Parameter Value');
ylabel('Maximum Lyapunov Exponent');
title('Parameter vs. Maximum Lyapunov Exponent Plot');
Hi @noura,
It is not about matching plots, hope that you are aware that the Lyapunov exponent provides insights into the system's sensitivity to initial conditions. So, in chaotic systems, positive Lyapunov exponents indicate sensitive dependence on initial conditions, while negative exponents suggest convergence towards a stable state. When you observe the plot, the system may exhibit chaotic behavior with positive Lyapunov exponents, indicating sensitivity to initial conditions. As the parameter value increases, the system dynamics may stabilize, leading to a decrease in the Lyapunov exponent, suggesting convergence towards a stable state. The calculate_lyapunov function is modified below to handle negative Lyapunov exponents by using subtraction instead of addition when updating the Lyapunov value. This adjustment is crucial for accurately capturing the behavior of the system, especially when dealing with convergence. To assess if the Lyapunov exponents are decreasing, we need to interpret the plotted data. By observing your plot, you need to observe if you see a decreasing Lyapunov exponent curve, it will signify that the system trajectories are converging towards a stable equilibrium which implies that perturbations in the system diminish over time, leading to stability. Conversely, an increasing Lyapunov exponent curve will show that the system trajectories are diverging, moving away from each other. This divergence indicates instability or chaotic behavior within the system.
% Modify the dynamical system function to induce convergence
function [x_next, y_next] = dynamical_system(x, y, d)
x_next = 3.4*x*(1-x)-x*y;
y_next = -0.2*y + d*x*y; % Adjusted dynamics for convergence
end
% Modify the Lyapunov exponent calculation for negative values
function lyapunov = calculate_lyapunov(x, y, d, iterations)
lyapunov = 0;
for i = 1:iterations
[x_next, y_next] = dynamical_system(x, y, d);
lyapunov = lyapunov - log(abs(d * (1 - 2 * x_next))); % Use subtraction for negative Lyapunov exponent
x = x_next;
y = y_next;
end
lyapunov = lyapunov / iterations;
end
Hope, this helps.
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Computations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


