some one help my in Computation of the Feigenbaum delta

조회 수: 24 (최근 30일)
ibrahim
ibrahim 2023년 11월 13일
답변: Akshat Dalal 2023년 11월 22일
can you solve that
% Compute the Feigenbaum delta
% Store approximate values in the row vector delta for assessment, where length(delta)= num_doublings and
% delta(2:num_doublings) are computed from the algorithm described in Lectures 21-23.
num_doublings=11; delta=zeros(1,num_doublings); delta(1)=5;
% Write your code here
% Initialize arrays to store results
num_doublings=11; delta=zeros(1,num_doublings);
m0=2;
m1=1+sqrt(5);
x=0.5;
dx=0;
delta(1) = 5;
% Set initial value of delta_values to 5
r_increment = 0.01;
% Loop 1: Iterate over different periods
for doubling = 1:num_doublings-1
doubling=doubling+1;
period = 2^doubling;
m=m1+(m1-m0)/delta(doubling-1);
m0=m1;
m1=m;
r = 0.5; % Initial value of r
rn_prev = r;
% Loop 2: Newton's method
for iteration_loop2 = 1:50
x = 0.5; % Initial guess for Newton's method
dx = 0;
% Loop 3: Iterate the logistic map
for iteration_logistic = 1:period
x = m * x * (1 - x); % Logistic map iteration
dx = m *(1-x)+m*dx* (1 - 2 * x); % Derivative of logistic map
end
end
m=m-(x-0.5)/dx;
delta(doubling) =m;
end
% Output your results
fprintf('n delta(n)\n');
for n=1:num_doublings
fprintf('%2g %18.15f\n',n,delta(n));
end
this is my code

답변 (1개)

Akshat Dalal
Akshat Dalal 2023년 11월 22일
Hi Ibrahim,
I understand that you have written a script for computing the Feigenbaum Delta from Logistic map and are facing some issues. I went through your code and had some observations:
  • You are changing the value of the first for-loop iterator ‘doubling’ at line 17. Although this does not affect the number of times the loop executes, this is not recommended as it may cause confusion in the code. You could redesign you script in a way to avoid this.
doubling=doubling+1;
  • In Newton’s method, you are updating the value of ‘m’ outside for-loop 2 at line 36. It should be done inside for-loop 2 after you iterate through the logistic map in for-loop 3.
% Loop 2: Newton's method
for iteration_loop2 = 1:50
x = 0.5; % Initial guess for Newton's method
dx = 0;
% Loop 3: Iterate the logistic map
for iteration_logistic = 1:period
x = m * x * (1 - x); % Logistic map iteration
dx = m *(1-x)+m*dx* (1 - 2 * x); % Derivative of logistic map
end
m=m-(x-0.5)/dx;
end
  • The reassigning of ‘m0’ and ‘m1’ is done before for-loop 2. It should be done after that, so that their new values could be used in calculation of ‘m’ during the next iteration.
  • Apart from that, you could also try different values of ‘x’ in Newton’s method for better results.
I hope this helps.

카테고리

Help CenterFile Exchange에서 Power and Energy Systems에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by