-
Notifications
You must be signed in to change notification settings - Fork 1
/
iterationAnalysis.m
124 lines (102 loc) · 2.37 KB
/
iterationAnalysis.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
% Analyse pathes of a seeds during iteration of a function
clear all
clc
%% Plot the development of the orbit for a function:
clear all
clc
% Intressant: Q_-2 mit seed 0.3
N = 4;
chaosfct = @(x) x.^2 -.1;
seed = 0.8;
[x,y] = orbitCoords(seed,N,chaosfct);
plotmax = max(abs([x,y]))*1.1;
plotmin = -plotmax;
%plotmax = max(coords)*1.1;
%plotmin = min(coords)*1.1;
for i = 1:1:length(x)
% Orbit:
plot(x(1:i),y(1:i))
hold on
title(['iter = ',num2str(floor(i/2))])
% Function:
fplot(chaosfct,[plotmin plotmax]*2)
% Diagonal:
fplot(@(x) x,[plotmin plotmax]*2,'Linewidth',2,'--')
% Vertical:
line([0 0],[plotmin plotmax],'Color','k')
% Horizontal:
horizl = refline(0);
horizl.Color = 'k';
% Seed Marker:
plot(x(1),y(1),'o','MarkerSize',10)
hold off
xlim([plotmin plotmax])
ylim([plotmin plotmax])
%axis equal
grid on
pause(.2)
end
%% Plot orbits for different seeds sequentially for a function
clear all
clc
N = 20;
chaosfct = @(x) x.^2 -.1;
plotmax = 1.5;
plotmin = -plotmax;
for seed = -1:.01:1
[x,y] = orbitCoords(seed,N,chaosfct);
% Orbit:
plot(x,y)
hold on
title(['seed = ',num2str(seed)])
% Function:
fplot(chaosfct,[plotmin plotmax]*2)
% Diagonal:
fplot(@(x) x,[plotmin plotmax]*2,'Linewidth',2,'--')
% Vertical:
line([0 0],[plotmin plotmax],'Color','k')
% Horizontal:
horizl = refline(0);
horizl.Color = 'k';
% Seed Marker:
plot(x(1),y(1),'o','MarkerSize',10)
hold off
xlim([plotmin plotmax])
ylim([plotmin plotmax])
%axis equal
grid on
pause(.02)
end
%% Plot orbits for different parameters sequentially
clear all
clc
N = 20;
seed = 0.1;
plotmax = 2;
plotmin = -plotmax;
for c = 2:-.02:-2
chaosfct = @(x) x.^2 + c;
%fifi = @(x) x.^-c - 1;
[x,y] = orbitCoords(seed,N,chaosfct);
% Orbit:
plot(x,y)
hold on
title(['c = ',num2str(c)])
% Function:
fplot(chaosfct,[plotmin plotmax]*2)
% Diagonal:
fplot(@(x) x,[plotmin plotmax]*2,'Linewidth',2,'--')
% Vertical:
line([0 0],[plotmin plotmax],'Color','k')
% Horizontal:
horizl = refline(0);
horizl.Color = 'k';
% Seed Marker:
plot(x(1),y(1),'o','MarkerSize',10)
hold off
xlim([plotmin plotmax])
ylim([plotmin plotmax])
%axis equal
grid on
pause(.01)
end