-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMkSg_map.m
794 lines (752 loc) · 19.9 KB
/
MkSg_map.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
function s = MkSg_Map(mapName,N,s0,params,eta)
% returns a time series obtained from given conservative map from the
% list of maps in Chaos and Time-Series Analysis by J. C. Sprott
% Output is a signal, s, that has as each column an output from a coordinate of
% the specified map
%-------------------------------------------------------------------------------
%% Set broad defaults
if nargin < 1 || isempty(mapName)
mapName = 'Chirikov'; % Henon map
end
if nargin < 2 || isempty(N)
N = 1000; % time series 1000 points long
end
if nargin < 5 || isempty(eta)
eta = 500; % remove transient -- first 500 data points
end
% Set other defaults within each specific map
switch mapName
%%% Sprott Conservative Maps
case 'Chirikov'
%% Chirikov (standard) map
% Sprott conservative map
% parameter is k
% Set defaults
if nargin < 3 || isempty(s0), s0 = [0.1,6]; end
if nargin < 4 || isempty(params), params = 1; end
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
k = params;
% Simulate the map
for i = 2:N+eta
y(i) = mod(y(i-1) + k*sin(x(i-1)), 2*pi);
x(i) = mod(x(i-1) + y(i), 2*pi);
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'Henonqm'
%% Henon area-preserving quadratic map
% Sprott conservative map
% Parameter is alpha
% Set defaults
if nargin < 3 || isempty(s0), s0 = [0.6,0.13]; end
if nargin < 4 || isempty(params), params = acos(0.24); end
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
alpha = params;
% Simulate the map
for i = 2:N+eta
x(i) = x(i-1)*cos(alpha) - (y(i-1) - x(i-1)^2) * sin(alpha);
y(i) = x(i-1)*sin(alpha) + (y(i-1) - x(i-1)^2) * cos(alpha);
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'Arnold'
%% Arnold's cat map
% Sprott conservative map
% Set defaults
if nargin < 3 || isempty(s0), s0=[0,1/sqrt(2)]; end % normal initial conditions
if nargin < 4 || isempty(params), params = 2; end % k=2, normal
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
k = params;
% Simulate the map
for i=2:N+eta
x(i) = mod(x(i-1) + y(i-1), 1);
y(i) = mod(x(i-1) + k*y(i-1), 1);
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'Gingerbreadman'
%% Gingerbreadman map
% Sprott conservative map
% Set defaults
if nargin < 3 || isempty(s0), s0=[0.51,3.7]; end % initial conditions
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% <No parameters>
% Simulate the map
for i=2:N+eta
x(i) = 1 + abs(x(i-1)) - y(i-1);
y(i) = x(i-1);
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'Chaoticweb'
%% Chaotic web map
% Sprott conservative map
% Set defaults
if nargin < 3 || isempty(s0), s0=[0,2.98]; end % initial conditions
if nargin < 4 || isempty(params), params = [pi/2, 1]; end % alpha = pi/2, k = 1
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
alpha = params(1);
k = params(2);
% Simulate the map
for i=2:N+eta
x(i) = x(i-1)*cos(alpha) - (y(i-1) + k*sin(x(i-1))) * sin(alpha);
y(i) = x(i-1)*sin(alpha) + (y(i-1) + k*sin(x(i-1))) * cos(alpha);
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'Lorenz3d'
%% Lorenz 3D chaotic map
% Sprott conservative map
% Set defaults
if nargin < 3 || isempty(s0), s0=[0.5,0.51,-0.99]; end % initial conditions
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
z = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
z(1) = s0(3);
% < No Parameters >
% Simulate the map
for i=2:N+eta
x(i) = x(i-1)*y(i-1)-z(i-1);
y(i) = x(i-1);
z(i) = y(i-1);
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
z = z(1+eta:end);
% Package into signal output
s = [x,y,z];
%%% Sprott: Dissipative Maps
case 'Henon'
%% Henon map
% Sprott dissipative map
% Set defaults
if nargin < 3 || isempty(s0), s0=[0.1,0.8]; end % initial conditions
if nargin < 4 || isempty(params), params = [1.4, 0.3]; end % a=1.4, b=0.3 (nominal)
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
a = params(1);
b = params(2);
% Simulate the map
for i=2:N+eta
x(i) = 1 - a*x(i-1)^2 + b*y(i-1);
y(i) = x(i-1);
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'Lozi'
%% Lozi map
% Sprott dissipative map
% Set defaults
if nargin < 3 || isempty(s0), s0=[-0.2,0.1]; end % initial conditions
if nargin < 4 || isempty(params), params = [1.7, 0.5]; end % a=1.4, b=0.3 (nominal)
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
a = params(1);
b = params(2);
% Simulate the map
for i=2:N+eta
x(i) = 1 - a*abs(x(i-1)) + b*y(i-1);
y(i) = x(i-1);
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'DelayedLogistic'
%% Delayed logistic map
% Sprott dissipative map
% Set defaults
if nargin < 3 || isempty(s0), s0=[0.001,0.001]; end % initial conditions
if nargin < 4 || isempty(params), params = 2.27; end % A=2.27 (nominal)
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
A = params;
% Simulate the map
for i=2:N+eta
x(i) = A*x(i-1)*(1-y(i-1));
y(i) = x(i-1);
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'Tinkerbell'
%% Tinkerbell map
% Sprott dissipative maps
% Set defaults
if nargin < 3 || isempty(s0), s0=[0.1,0.4]; end % initial conditions
if nargin < 4 || isempty(params), params = [0.9, -0.6, 2, 0.5]; end % a,b,c,d -- all nominal
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
a = params(1);
b = params(2);
c = params(3);
d = params(4);
% Simulate the map
for i=2:N+eta
x(i) = x(i-1)^2 - y(i-1)^2 + a*x(i-1) + b*y(i-1);
y(i) = 2*x(i-1)*y(i-1) + c*x(i-1) + d*y(i-1);
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'Burgers'
%% Burgers map
% Sprott dissipative maps
% Set defaults
if nargin < 3 || isempty(s0), s0=[-0.2,0.1]; end % initial conditions
if nargin < 4 || isempty(params), params = [0.75, 1.75]; end % a,b -- nominal
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
a = params(1);
b = params(2);
% Simulate the map
for i=2:N+eta
x(i) = a*x(i-1) - y(i-1)^2;
y(i) = b*y(i-1) + x(i-1)*y(i-1);
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'HolmesCubic'
%% Holmes Cubic map
% Sprott dissipative maps
% Set defaults
if nargin < 3 || isempty(s0), s0=[1.7,0]; end % initial conditions
if nargin < 4 || isempty(params), params = [0.2, 2.77]; end % b,d -- nominal
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
b = params(1);
d = params(2);
% Simulate the map
for i=2:N+eta
x(i) = y(i-1);
y(i) = -b*x(i-1) + d*y(i-1) - y(i-1)^3;
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'KaplanYorke'
%% Kaplan-Yorke map
% Sprott dissipative maps
% Set defaults
if nargin < 3 || isempty(s0), s0=[1/sqrt(2),-0.4]; end % initial conditions (usual)
if nargin < 4 || isempty(params), params = [1.99999999, 0.2]; end % a,b -- nominal
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
a = params(1);
b = params(2);
% Simulate the map
for i=2:N+eta
x(i) = mod(a*x(i-1),1);
y(i) = mod(b*y(i-1) + cos(4*pi*x(i-1)), 1);
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'DissipativeStandard'
%% Dissipative Standard map
% Sprott dissipative maps
% Set defaults
if nargin < 3 || isempty(s0), s0=[1/sqrt(2),-0.4]; end % initial conditions (usual)
if nargin < 4 || isempty(params), params = [0.1, 8.8]; end % b,k -- nominal
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
b = params(1);
k = params(2);
% Simulate the map
for i=2:N+eta
y(i) = mod(b*y(i-1) + k*sin(x(i-1)), 2*pi);
x(i) = mod(x(i-1) + y(i),2*pi);
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'Ikeda'
%% Ikeda map
% Sprott dissipative maps
% Set defaults
if nargin < 3 || isempty(s0), s0=[0.05,0]; end % initial conditions
if nargin < 4 || isempty(params), params = [6, 0.4, 1, 0.9]; end % alpha, beta, gamma, mu -- nominal
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
alpha = params(1);
beta = params(2);
gamma = params(3);
mu = params(4);
% Simulate the map
for i=2:N+eta
theta = beta - alpha/(1 + x(i-1)^2 + y(i-1)^2);
x(i) = gamma + mu*(x(i-1)*cos(theta) - y(i-1)*sin(theta));
y(i) = mu*(x(i-1)*sin(theta) + y(i-1)*cos(theta));
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'Sinai'
%% Sinai map
% Sprott dissipative maps
% Set defaults
if nargin < 3 || isempty(s0), s0=[0.5,0.5]; end % initial conditions
if nargin < 4 || isempty(params), params = 0.10; end % delta
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
delta = params;
% Simulate the map
for i=2:N+eta
x(i) = mod(x(i-1) + y(i-1) + delta*cos(2*pi*y(i-1)), 1);
y(i) = mod(x(i-1) + 2*y(i-1),1);
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
case 'PredatorPrey'
%% Discrete Predator-Prey Map
% Sprott dissipative maps
% Set defaults
if nargin < 3 || isempty(s0), s0=[0.5,0.5]; end % initial conditions
if nargin < 4 || isempty(params), params = [0.3, 1, 5]; end % r, K, alpha (normal)
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Parameters
r = params(1);
K = params(2);
alpha = params(3);
% Simulate the map
for i=2:N+eta
x(i) = x(i-1)*exp(r*(1 - x(i-1)/K) - alpha*y(i-1));
y(i) = x(i-1)*(1 - exp(-alpha*y(i-1)));
end
% Remove transient
x = x(1+eta:end);
y = y(1+eta:end);
% Package into signal output
s = [x,y];
%%% Autoregressive Maps
case 'FreitasStochasticSine'
%% Freitas stochastic sine map
% Map from the literature: Freitas, Letellier, Aguirre: PRE 79,035201(R) (2009)
% x_{n+1},0 = mu*sin(x_n) + Y_n*eta_n
% Y_n is Bernoulii: y=binornd(1,q,[]) q is the probability y=1
% eta is (cts) uniform random: eta=unifrnd(-b,b,[]) with magnitude b
% So when q=0, it's a sine map on a period-2 limit cycle, otherwise it
% occasionally gets kicked, perhaps to another limit cycle (there are two fixed
% points -- at -2 and at 2)
% Set defaults
if nargin < 3 || isempty(s0), s0 = unifrnd(-1,1,1); end % initial conditions
if nargin < 4 || isempty(params), params = [2.4, 1, 0.1]; end % mu, b, q
% Parameters
mu = params(1); % amplitude of sine
b = params(2); % amplitude of noise
q = params(3); % probability of random kick occurring
% Initialize
x = zeros(N+eta,1);
y = binornd(1,q,[N+eta, 1]);
n = unifrnd(-b,b,[N+eta, 1]);
% Initial condition
x(1) = s0;
% Simulate the map
for i = 2:N+eta
x(i) = mu*sin(x(i-1)) + y(i)*n(i);
end
% Remove transient
x = x(1+eta:end);
% Package into signal output, s
s = x;
case 'FreitasNonlinearMA'
%% Freita's Nonlinear Moving Average Filter
% Map from the literature: Freitas, Letellier, Aguirre: PRE 79,035201(R) (2009)
% A nonlinear moving average filter of uniform random noise:
% x_{n},0 = a*u_n + b*u_{n-1},0*(1-u_n)
% The paper didn't give values for the parameters a and b:
% I have just used uniform random numbers for both a and b between -5 and 5,
% Getting a new value at each iteration, and with each interation receiving two occurances [1 2]
% initial condition is also uniform continuous random [-5 5]
% Set defaults
if nargin < 3 || isempty(s0), s0 = unifrnd(-5,5,1); end % initial conditions
if nargin < 4 || isempty(params), params = [2, 1]; end % a, b
% Initialize
x = zeros(N+eta,1);
u = unifrnd(0,1,[N+eta 1]);
% Initial conditions
x(1) = s0;
% Parameters
a = params(1);
b = params(2);
% Simulate the map
for i=2:N+eta
x(i) = a*u(i) + b*u(i-1)*(1-u(i));
end
% Remove transient
x = x(1+eta:end);
% Package into signal output, s
s = x;
case 'CaoPeriodic'
%% Cao Periodic Map
% To show his method for determining the dimension he uses this four-dimensional system:
% x_{n+4},0 = sin(x_n+5) + sin(2x_{n+1},0+5) + sin(3x_{n+2},0+5) + sin(4x_{n+3},0+5)
% Not quite autoregressive... Nonlinear autoregressive maybe?
% Set defaults
if nargin < 3 || isempty(s0), s0 = rand(4,1); end % initial conditions (4 of them)
% Initialize
x = zeros(N+eta,1);
% Initial conditions
x(1:4) = s0;
% Simulate the map
for i=5:N+eta
x(i) = sin(x(i-4)+5) + sin(2*x(i-3)+5) + sin(3*x(i-2)+5) + sin(4*x(i-1)+5);
end
% Remove transient
x = x(1+eta:end);
% Package into signal output, s
s = x;
%%% Sprott's Noninvertible Maps
% Appendix A.1 of his book
case 'logistic'
%% Logistic Map
% Set defaults
if nargin < 3 || isempty(s0), s0 = 0.1; end % normal initial conditions
if nargin < 4 || isempty(params), params = 4; end % A=4, chaos
% Initialize
x = zeros(N+eta,1);
% Initial conditions
x(1) = s0;
% Parameters
A = params;
% Simulate the map
for i=2:N+eta
x(i) = A*x(i-1)*(1-x(i-1));
end
% Remove transient as signal to return
s = x(1+eta:end);
case 'sine'
%% Sine Map
% Set defaults
if nargin < 3 || isempty(s0), s0 = 0.1; end % initial condition
if nargin < 4 || isempty(params), params = 1; end % A=1, chaos
% Initialize
x = zeros(N+eta,1);
% Initial conditions
x(1) = s0;
% Parameters
A = params;
% Simulate the map
for i=2:N+eta
x(i)=A*sin(pi*x(i-1));
end
% Remove transient as signal to return
s = x(1+eta:end);
case 'tent'
%% Tent Map
% Set defaults
if nargin < 3 || isempty(s0), s0 = 1/sqrt(2); end % normal initial conditions
if nargin < 4 || isempty(params), params = 1.9999999; end % A=1.999999, chaos
% Initialize
x = zeros(N+eta,1);
% Initial conditions
x(1) = s0;
% Parameters
A = params;
% Simulate the map
for i=2:N+eta
x(i) = A*min([x(i-1), 1-x(i-1)]);
end
% Remove transient as signal to return
s = x(1+eta:end);
case 'lincongen'
%% Linear Congruential Generator
% Set defaults
if nargin < 3 || isempty(s0), s0 = 0.1; end % initial condition
if nargin < 4 || isempty(params), params = [7141, 54773, 259200]; end % [A,B,C] -- nominal
% Initialize
x = zeros(N+eta,1);
% Initial conditions
x(1) = s0;
% Parameters
A = params(1);
B = params(2);
C = params(3);
% Simulate the map
for i=2:N+eta
x(i) = mod(A*x(i-1) + B,C);
end
% Remove transient as signal to return
s = x(1+eta:end);
case 'cubic'
%% Cubic Map
% Set defaults
if nargin < 3 || isempty(s0), s0 = 0.1; end % initial condition
if nargin < 4 || isempty(params), params = 2.6; end % A
% Initialize
x = zeros(N+eta,1);
% Initial conditions
x(1) = s0;
% Parameters
A = params;
% Simulate the map
for i=2:N+eta
x(i) = A*x(i-1)*(1-x(i-1)^2);
end
% Remove transient as signal to return
s = x(1+eta:end);
case 'rickerspopulation'
%% Ricker's Population Model
% Set defaults
if nargin < 3 || isempty(s0), s0 = 0.1; end % initial condition
if nargin < 4 || isempty(params), params = 20; end % A
% Initialize
x = zeros(N+eta,1);
% Initial conditions
x(1) = s0;
% Parameters
A = params;
% Simulate the map
for i=2:N+eta
x(i) = A*x(i-1)*exp(-x(i-1));
end
% Remove transient as signal to return
s = x(1+eta:end);
case 'Gauss'
%% Gauss map
% Set defaults
if nargin < 3 || isempty(s0), s0 = 0.1; end % initial condition
% Initialize
x = zeros(N+eta,1);
% Initial conditions
x(1) = s0;
% Simulate the map
for i=2:N+eta
x(i)=mod(1/x(i-1),1); % Gauss Map
end
% Remove transient as signal to return
s = x(1+eta:end);
case 'Cusp'
%% Cusp map
% Set defaults
if nargin < 3 || isempty(s0), s0 = 0.1; end % initial condition
if nargin < 4 || isempty(params), params = 1.95; end % A
% Initialize
x = zeros(N+eta,1);
% Initial conditions
x(1) = s0;
% Parameters
A = params;
% Simulate the map
for i=2:N+eta
x(i) = 1 - A*sqrt(abs(x(i-1)));;
end
% Remove transient as signal to return
s = x(1+eta:end);
case 'GaussWCM'
%% Gaussian white chaotic map
% Set defaults
if nargin < 3 || isempty(s0), s0 = 0.1; end % initial condition
% Initialize
x = zeros(N+eta,1);
% Initial conditions
x(1) = s0;
% Simulate the map
for i=2:N+eta
x(i)=abs(x(i-1))^(-0.25)-0.5-abs(x(i-1));
% x(i)=A*erfinv(1-2*erf(x(i-1)/A)); % Gaussian white chaotic map DOESN'T WORK
end
% Remove transient as signal to return
s = x(1+eta:end);
case 'Pinchers'
%% Pinchers Map
% Set defaults
if nargin < 3 || isempty(s0), s0 = 0; end % initial condition
if nargin < 4 || isempty(params), params = [2, 0.5]; end % [s,c]
% Initialize
x = zeros(N+eta,1);
% Initial conditions
x(1) = s0;
% Parameters
s = params(1);
c = params(2);
% Simulate the map
for i=2:N+eta
x(i) = abs(tanh(s*(x(i-1)-c)));
end
% Remove transient as signal to return
s = x(1+eta:end);
case 'Spence'
%% Spence Map
% Set defaults
if nargin < 3 || isempty(s0), s0 = 0.1; end % initial condition
% Initialize
x = zeros(N+eta,1);
% Initial conditions
x(1) = s0;
% Simulate the map
for i=2:N+eta
x(i) = abs(log(x(i-1)));
end
% Remove transient as signal to return
s = x(1+eta:end);
case 'Sinecircle'
%% Sine-circle Map
% Set defaults
if nargin < 3 || isempty(s0), s0 = 0; end % initial condition
if nargin < 4 || isempty(params), params = [2.1, 0.44]; end % [K, Omega]
% Initialize
x = zeros(N+eta,1);
% Initial conditions
x(1) = s0;
% Parameters
K = params(1);
Omega = params(2);
% Simulate the map
for i=2:N+eta
x(i) = mod(x(i-1) + Omega - K/(2*pi)*sin(2*pi*x(i-1)),1);
end
% Remove transient as signal to return
s = x(1+eta:end);
%%% More Maps
case 'Julia'
%% Julia Map
% Not sure where I got this map from. It's probably mentioned in Sprott.
% Can't get it to do anything interesting
% Set defaults
if nargin < 3 || isempty(s0), s0 = [0.1, 0.1]; end % initial condition
% Initialize
x = zeros(N+eta,1);
y = zeros(N+eta,1);
% Initial conditions
x(1) = s0(1);
y(1) = s0(2);
% Simulate the map
for i=2:N+eta
x(i) = x(i-1)^2 - y(i-1)^2 - 1;
y(i) = 2*x(i-1)*y(i-1);
end
% Remove transient as signal to return
s = [x(1+eta:end) y(1+eta:end)];
otherwise
disp(['Invalid map name']);
s = NaN;
return
end
end