1D flows seem to have one of two behaviour
Apart from this we may have a behaviour where
We will study here the bifurcations of flows on a 1D line Let's consider the first example: $\dot{x} = r + x^2$
set(0, "defaultlinelinewidth", 2);
set (0, "defaulttextfontname", "TimesNewRoman")
set (0, "defaulttextfontsize", 20)
set (0, "DefaultAxesFontName", "TimesNewRoman")
set(0, 'DefaultAxesFontSize', 20)
clear;
clc; close all;
h.ax = axes ("position", [0.05 0.4 0.5 0.5]); #reduce plot windows size to accomodate sliders
function update_plot (obj, init = false)
## gcbo holds the handle of the control
h = guidata (obj);
replot = false;
recalc = false;
switch (gcbo) # If we make any change then we replot
case {h.print_pushbutton}
fn = uiputfile ("*.png");
print (fn);
case {h.slider1}
recalc = true;
end
if (recalc || init)
r = -2 + 4*get (h.slider1, "value");
set (h.label1, "string", sprintf ("r: %.1f", r));
x = linspace(-2,2);
xd = r + x.^2;
h.plot = plot(x, xd, x, 0.*x, '-k');
guidata (obj, h);
else
set (h.plot, "ydata", y);
end
end
# specify the GUI plot properties like sliders and label formatting
## print figure
h.print_pushbutton = uicontrol ("style", "pushbutton",
"units", "normalized",
"string", "print plot\n(pushbutton)",
"callback", @update_plot,
"position", [0.6 0.45 0.35 0.09]);
## guess
h.label1 = uicontrol ("style", "text",
"units", "normalized",
"string", "Guess:",
"horizontalalignment", "left",
"position", [0.05 0.25 0.35 0.08]);
h.slider1 = uicontrol ("style", "slider",
"units", "normalized",
"string", "slider",
"callback", @update_plot,
"value", 0.1,
"position", [0.05 0.20 0.35 0.06]);
set (gcf, "color", get(0, "defaultuicontrolbackgroundcolor"))
guidata (gcf, h)
update_plot (gcf, true);
We can then plot the equilibrium points as the parameter r
is varied. Along with that we can also plot whether that particular point is a stable or unstable point. This gives a clear identification of the nature of the roots.
function y=f(x, r)
y = r + x.^2;
end
function dy=dfdx(x, r)
dy=2*x;
end
x = linspace(-2, 2);
r_a = linspace(-2, 2);
for r = r_a
[sol, fval, info]= fsolve(@(x) f(x, r), [-2;2]);
if info == 1 # Solution has convered
count=0;
for i = 1:length(sol)
root = sol(i);
slope_at_root = dfdx(root, r);
if slope_at_root > 0
plot(r, root, 'bx')
else
plot(r, root, 'ro')
hold on
end
end
end
end
line ([min(r_a) max(r_a)], [0 0], "linestyle", "-", "color", "c");
line ([0 0], [min(r_a) max(r_a)],"linestyle", "-", "color", "c");
xlim([min(r_a) max(r_a)])
xlabel("r");
ylabel("x*");
title("Saddle node bifurcation")
The above diagram clearly elucidates how increasing the parameter r
beyond 0 yields no equilibrium point while for $r<0$ we have one stable and one unstable branch. This is an example of a saddle node bifurcation.
In the example below, we show the same saddle node bifurcation in a slightly distored form. The normal form of the equation below, i.e. $\dot{x} = r - x - \exp{-x}$ is of the same form as $\dot{x} = r + x^2$
function y=f(x, r)
y= r - x - exp(-x);
end
function dy=dfdx(x, r)
dy= -1 + exp(-x);
end
x = linspace(-2, 2);
r_a = linspace(-2, 2, 200);
for r = r_a
[sol, fval, info]= fsolve(@(x) f(x, r), [-2;2]);
if info == 1 # Solution has convered
for i = 1:length(sol)
root = sol(i);
slope_at_root = dfdx(root, r);
if slope_at_root > 0
plot(r, root, 'bx')
else
plot(r, root, 'ro')
hold on
end
end
end
end
line ([min(r_a) max(r_a)], [0 0], "linestyle", "-", "color", "c");
line ([0 0], [min(r_a) max(r_a)],"linestyle", "-", "color", "c");
line ([1 1], [min(r_a) max(r_a)],"linestyle", "-", "color", "c");
xlim([min(r_a) max(r_a)])
xlabel("r");
ylabel("x*");
title("Saddle node bifurcation")
text(0.5, -1.2, "Unstable branch")
text(0.5, 1.2, "Stable branch")