Hello, I'm trying to approximate the Feigenbaum constant by using the logistic map. I came up with a script that gives you the bifurcation parameters, as below:
for k=nl:nh
if abs(x(k,nit+1)-x(k,nit+1-2))<e
b(2)=a(k);
elseif abs(x(k,nit+1)-x(k,nit+1-4))<e
b(3)=a(k);
elseif abs(x(k,nit+1)-x(k,nit+1-8))<e
b(4)=a(k);
elseif abs(x(k,nit+1)-x(k,nit+1-16))<e
b(5)=a(k);
elseif abs(x(k,nit+1)-x(k,nit+1-32))<e
b(6)=a(k);
elseif abs(x(k,nit+1)-x(k,nit+1-64))<e
b(7)=a(k);
elseif abs(x(k,nit+1)-x(k,nit+1-128))<e
b(8)=a(k);
elseif abs(x(k,nit+1)-x(k,nit+1-256))<e
b(9)=a(k);
break
end
end
('nit' means number of iterations, and k is related to the parameter a (r in some references))
Now it seems obvious that there is a simpler representation of the above code, as the integers are just the first eight exponents of 2. But I just can't come up with one. Could somebody help me?

 采纳的回答

Stephen23
Stephen23 2018-9-13
编辑:Stephen23 2018-9-13
Assuming that e is a scalar, you could create the index for b using a vector, something like this:
for k = ...
idb = nnz(abs(x(k,nit+1)-x(k,nit+1-pow2(1:8)))<e)
b(idb) = a(k)
end
You will need to add some special conditions for zero, one, and for that break statement.

1 个评论

Thanks for the answer! Based on your reply (with a few adjustments) I was able to reproduce the same results.

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

产品

标签

Community Treasure Hunt

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

Start Hunting!

Translated by