-
Notifications
You must be signed in to change notification settings - Fork 1
/
chaos.m
100 lines (95 loc) · 2.23 KB
/
chaos.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
function x = chaos(index, n)
x(1)=rand();
switch index
%Chebyshev map
case 1
for i=1:n
x(i+1)=cos(i*acos(x(i)));
G(i)=((x(i)+1)*100)/2;
end
case 2
%Circle map
a=0.5;
b=0.2;
for i=1:n
x(i+1)=mod(x(i)+b-(a/(2*pi))*sin(2*pi*x(i)),1);
G(i)=x(i)*100;
end
case 3
%Gauss/mouse map
for i=1:n
if x(i)==0
x(i+1)=0;
else
x(i+1)=mod(1/x(i),1);
end
G(i)=x(i)*100;
end
case 4
%Iterative map
a=0.7;
for i=1:n
x(i+1)=sin((a*pi)/x(i));
G(i)=((x(i)+1)*100)/2;
end
%normalize it from [-1 1] to [0 1]
a=-1; b=1; c=0; d=1;
x=((x-a)*(d-c))/(b-a);
case 5
%Logistic map
a=4;
for i=1:n
x(i+1)=a*x(i)*(1-x(i));
G(i)=x(i)*100;
end
case 6
%Piecewise map
P=0.4;
for i=1:n
if x(i)>=0 && x(i)<P
x(i+1)=x(i)/P;
end
if x(i)>=P && x(i)<0.5
x(i+1)=(x(i)-P)/(0.5-P);
end
if x(i)>=0.5 && x(i)<1-P
x(i+1)=(1-P-x(i))/(0.5-P);
end
if x(i)>=1-P && x(i)<1
x(i+1)=(1-x(i))/P;
end
G(i)=x(i)*100;
end
case 7
%Sine map
for i=1:n
x(i+1) = sin(pi*x(i));
G(i)=(x(i))*100;
end
case 8
%Singer map
u=1.07;
for i=1:n
x(i+1) = u*(7.86*x(i)-23.31*(x(i)^2)+28.75*(x(i)^3)-13.302875*(x(i)^4));
G(i)=(x(i))*100;
end
case 9
%Sinusoidal map
for i=1:n
x(i+1) = 2.3*x(i)^2*sin(pi*x(i));
G(i)=(x(i))*100;
end
case 10
%Tent map
x(1)=0.6;
for i=1:n
if x(i)<0.7
x(i+1)=x(i)/0.7;
end
if x(i)>=0.7
x(i+1)=(10/3)*(1-x(i));
end
G(i)=(x(i))*100;
end
end
O=x;