How to plot the unstable points in this bifurcation diagram?
6 次查看(过去 30 天)
显示 更早的评论
I'm plotting a bifurcation diagram of of the logist map. I'm trying to add the unstable curve in the diagram, just like in fig. 1. but I have no clue about how to do it.
Fig 1 - Thye dashed line are the unstable curve.
Here is the diagram I get from my code:
And the code I'm using to perform this task.
clear
N = 2^14;
L = 2^9;
intervala = [1:(4-1)/3000:4];
k = 1;
for a = intervala
x = zeros(1, 1e4);
x(1) = 0.1;
for i = 1:N
x(i+1) = a*x(i)*(1-x(i));
end
h1(k) = mean(log(abs(a*(1-2*x((N-L-1):N)))));
stablex1(k,:) = x((N-L-1):N);
k = k + 1;
end
figure(21)
plot(intervala, stablex1,'.', 'color', 'k', 'MarkerSize', 0.5); hold on; axis([1 4 0 1]); hold off; %axis square;
xlabel('$$a$$');
ylabel('$$X$$');
Ax = gca;
Ax.XAxis.TickLabelInterpreter = 'latex';
Ax.YAxis.TickLabelInterpreter = 'latex';
Thanks in advance.
0 个评论
回答(1 个)
Abhishek Chakram
2024-1-23
Hi Wayner Klën,
It appears to me that you are facing difficulty in plotting unstable points in the given bifurcation diagram. For this, you can separately calculate and store the stable and unstable values and plot accordingly. Here is a sample code for the same:
% Define the range of the bifurcation parameter mu
mu_values = linspace(-2, 2, 1000);
% Initialize arrays to hold stable and unstable equilibrium points
stable_eq = [];
unstable_eq = [];
% Loop over mu values to compute equilibria and their stability
for mu = mu_values
% Example: Find equilibrium points for the equation x_dot = mu - x^2
eq_points = [sqrt(mu), -sqrt(mu)]; % Equilibria
% Stability analysis: In this example, the sign of the derivative
% at the equilibrium points determines stability
for eq = eq_points
if (mu - 2*eq) < 0 % Stable if the derivative is negative
stable_eq = [stable_eq; mu, eq];
else % Unstable if the derivative is positive
unstable_eq = [unstable_eq; mu, eq];
end
end
end
% Plot the bifurcation diagram
figure;
hold on;
plot(stable_eq(:,1), stable_eq(:,2), 'b', 'LineWidth', 2); % Stable points in blue
plot(unstable_eq(:,1), unstable_eq(:,2), 'r--', 'LineWidth', 2); % Unstable points in red dashed
xlabel('\mu');
ylabel('Equilibrium Points');
title('Bifurcation Diagram');
legend('Stable', 'Unstable');
hold off;
Here “stable_eq” array contains the stable points and “unstable_eq” contains the unstable points.
Hope this helps!
Best Regards,
Abhishek Chakram
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!