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일

0 개 추천

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

Seungwoo Yoo
Seungwoo Yoo 2018년 9월 15일
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에 대해 자세히 알아보기

제품

태그

질문:

2018년 9월 13일

댓글:

2018년 9월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by