Bifurcation Diagram will not graph
Show older comments
My code below will run but does not graph a bifurcation diagram it just results in an empty figure with axis, can anyone see what I have done wrong?
Thankyou
figure;
ax(1) = axes;
hold on
xlabel ('k');
ylabel ('C');
xlim([-2 2]);
ylim([0 40]);
x=1;
for k = [-0.5:0.1:1.6]
syms c
eqn = (1/10)*((c-23)*(25-c)*(c-29))-k ==0;
Solution = vpasolve(eqn, c);
x=x+1;
Solution
plot(ax(1), k, Solution)
end
Answers (1)
Plot the points —
figure;
ax(1) = axes;
hold on
xlabel ('k');
ylabel ('C');
xlim([-2 2]);
ylim([0 40]);
x=1;
k = [-0.5:0.1:1.6];
Solution = cell(size(k)); % Preallocate
for k1 = 1:numel(k)
syms c
eqn = (1/10)*((c-23)*(25-c)*(c-29))-k(k1) ==0;
Solution{:,k1} = double(vpasolve(eqn, c));
% x=x+1
plot(ax(1), k(k1), Solution{k1}, '.')
end
hold off
grid
Out = [k; cell2mat(Solution)]
Not what appears to me to be a bifurcation plot, however it is a plot!
Categories
Find more on Stress and Strain in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!