# 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?

10 visualizzazioni (ultimi 30 giorni)
Syed Zubair shah il 5 Apr 2022
Risposto: Paras Gupta il 22 Set 2023
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')
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (1)

Paras Gupta il 22 Set 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.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

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

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by