how to find lyapunov exponent for sine function sin(x) and how to plot it? if i have a code for logistic map? instead of logistic map lyapunov i want just sine lyapunov?

9 views (last 30 days)
clc
clear all
close all
r = 1:0.01:4;
for j=1:length(r)
x(1)=0.1;
lyap = 0;
for i = 1:length(r)
x(i+1) = r(j)*x(i)*(1-x(i)); %logistic map equation
lyap=lyap+log(abs(r(j)*(1-2*x(i)))); % after abs there is dericative of the logistic map
end
lamda(j) = lyap/1000;
end
figure(1)
plot(r,lamda)
grid on
xlabel('control parameter')
ylabel('lyapunov exponent')

Answers (1)

Paras Gupta
Paras Gupta on 22 Sep 2023
Hi Zubair,
I understand that you want to plot the Lyapunov exponent for the sine function.
The following changes can be made in the provided code to achieve the same:
  • Instead of using the logistic map equation, the sine function equation x(i+1) = r(j)*sin(x(i)) is used
  • The Lyapunov calculation has been updated to lyap = lyap + log(abs(r(j)*cos(x(i)))) based on the derivative of the sine function.
The modified code is given below:
clc;
clear all;
close all;
r = 1:0.01:4;
for j=1:length(r)
x(1)=0.1;
lyap = 0;
for i = 1:length(r)
x(i+1) = r(j)*sin(x(i)); % Sine function equation
lyap = lyap + log(abs(r(j)*cos(x(i)))); % Lyapunov calculation for sine function
end
lamda(j) = lyap/1000;
end
figure(1)
plot(r,lamda)
grid on
xlabel('control parameter')
ylabel('lyapunov exponent')
You can refer to the following documentations for more information on the function used in the code above:
I hope the above modifications will help to get the required results.

Categories

Find more on Matrix Computations in Help Center and File Exchange

Tags

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!