-
Notifications
You must be signed in to change notification settings - Fork 0
/
bifurcation_simple.jl
37 lines (35 loc) · 1.08 KB
/
bifurcation_simple.jl
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
using Plots
using LaTeXStrings
function logistic(a, x)
return a * x * (1 - x)
end
amin, amax, aN = 2.8, 4.0, 2000
as = range(amin, amax, length=aN) #2000
itmax = 1000 # number of iterations for each a
ihide = 1000 # number of hidden iterations before plotting
xtiny = 1e-10 # initial value for x
y = []
xx = []
# zc = [] # for colours
for a in as
x = xtiny
# ic = 0 # for colours
for i = 1:(ihide+itmax)
x = logistic(a, x)
if i > ihide
push!(y, x)
push!(xx, a)
# ic = mod(ic, 50) + 1
# push!(zc, ic)
end
end
end
da = (amax - amin) / aN
# p = scatter(xx, y, zcolor=zc, xlimits=(amin-2*da, amax+2*da), ylimits=(0, 1),
# ms=0.2, msw=0, color=palette(:bluesreds, length(unique(zc))), legend=false, grid=false, framestyle=:box)
p = scatter(xx, y, xlimits=(amin, amax), ylimits=(0, 1), mc=:black,
ms=0.2, msw=0, legend=false, grid=false, framestyle=:box)
xlabel!("\$\\alpha\$") # instead of the L marco
ylabel!(L"x_{n}")
title!(L"x_{n}=\alpha x_{n-1}(1-x_{n-1})");
savefig(p, "plots/bifurcation_simple.pdf")