Você está na página 1de 28

7/25/2017 DDE-BIFTOOL demo 1 - Neuron

DDE-BIFTOOL demo 1 - Neuron

(c) DDE-BIFTOOL v. 3.1.1(75), 31/12/2014

This demo is an illustrative example, which uses a system of delay differential equations taken from [Shay,99].

The demo will show

which functions the user has to provide and how to put them into the structure funcs (demo1_funcs.html)
continuation of equilibria in a single parameter, demo1_stst.html
computation of their stability (eigenvalues of linearization), demo1_stst.html
continuation of Hopf bifurcations in two parameters (demo1_hopf.html)
computation of normal form coefficients for Hopf bifurcations (to check if they are supercritical or subcritical), and of normal form
coefficients for codimension-two bifurcations encountered along Hopf curves (demo1_normalforms.html),
branching off from a Hopf bifurcation to continue a family of periodic orbits in a single parameter demo1_psol.html
computation of stability of periodic orbits (Floquet multipliers of linearization) demo1_psol.html
continuation of homoclinic connections in two parameters demo1_hcli.html
continuation of folds of periodic orbits in two parameters demo1_POfold.html

Contents
Differential equations
First step: the definition of user-defined functions, see demo1_funcs.html

Differential equations
The differential equations for this example are

This system models two coupled neurons with time delayed connections. It has two components ( and ), three delays ( , and
), and four other parameters ( , , and ).

The primary bifurcation parameter will be the second parameter is .

clear; % clear variables


format compact
close all; % close figures
addpath('../../ddebiftool/'); % add ddebiftool folder to path
%#ok<*ASGLU,*NOPTS,*NASGU>

First step: the definition of user-defined functions, see demo1_funcs.html

Published with MATLAB 7.14

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1.html 1/2
7/25/2017 DDE-BIFTOOL demo 1 - Neuron

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1.html 2/2
7/25/2017 Definition of user functions

Definition of user functions

(c) DDE-BIFTOOL v. 3.1.1(75), 31/12/2014

(Please load ddebiftool into path first, see demo1.html.) To define a system, the user should provide Matlab functions defining the
right-hand side (in the example called neuron_sys_rhs) and the indices for the delays in the parameter vector (called neuron_tau
in our example).

Contents
Right-hand side
Delays
Jacobians of user-provided functions
Definition of structure funcs
Save and continue to continuation and stability of steady states demo1_stst.html

Right-hand side
A function defining the right-hand side :

function y=sys_rhs(xx,par)

This function has two arguments, xx , which contains the state variable(s) at the present and in the past, xx
, par which contains the parameters, par .

For the example, this is ( is called neuron_sys_rhs in our example)

neuron_sys_rhs=@(xx,par)[...
-par(1)*xx(1,1)+par(2)*tanh(xx(1,4))+par(3)*tanh(xx(2,3));....
-par(1)*xx(2,1)+par(2)*tanh(xx(2,4))+par(4)*tanh(xx(1,2))];

Delays
The delays , are considered to be part of the parameters ( , ). This is natural since the stability
of steady solutions and the position and stability of periodic solutions depend on the values of the delays. Furthermore delays can
occur both as a 'physical' parameter and as delay, as in . From these inputs the right-hand side is evaluated at time
. For equations with constant delays DDE-Biftool determines which parameters are delays by calling an argument-less function of
the type

function d=sys_tau()

In the example we order the parameters as par . Thus, (giving it the name neuron_tau):

neuron_tau=@()[5,6,7];
ind_a21=4; % used later for continuation
ind_taus=7; % used later for continuation

Jacobians of user-provided functions


Optionally (recommended) the user may also specify the partial derivatives of the user-defined functions with respect to states,
delayed states and parameters. For constant delays only the derivatives of are required. They should be provided as a function of
the form
http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_funcs.html 1/3
7/25/2017 Definition of user functions
function J=sys_deri(xx,par,nx,np,v)

providing the partial derivatives of first and second order (see file neuron_sys_deri.html for details).

Definition of structure funcs


Similar to standard functions such as ode45 DDE-Biftool's routines now have an argument that defines the right-hand side. Since
DDE-Biftool needs several user-defined functions (sys_rhs, sys_tau, optionally sys_deri, sys_cond etc) these functions are collected
in a structure funcs. This structure funcs is best set up by calling the (new) DDE-Biftool routine set_funcs wit a sequence of
name-value pairs. Each name-value pair corresponds to a field in the structure. Fields that are not listed as arguments of set_funcs
get replaced by a default if possible.

Possible argument names are:

'sys_rhs' (default sys_rhs if file sys_rhs.m present in folder): right-hand side sys_tau
'sys_tau' (default @()[]): function defining delays
'sys_deri' (default @df_deriv): function defining partial derivatives of sys_rhs
'sys_ntau' (default 0, only needed for state-dependent delays) number of delays
'sys_cond' (default @dummy_cond) function providing extra conditions
'sys_dtau' (default @df_derit, only needed for state-dependent delays): function defining partial derivatives of sys_tau
'x_vectorized' (logical, default false) set to true if sys_rhs, sys_deri, (sys_tau and sys_dtau for SD-DDEs) accept an
argument xx with three dimensions. For periodic-orbit computations the function will be called with all collocation points
simultaneously if x_vectorized is true.

Other fields are tp_del (true if delays are state-dependent), sys_deri_provided (true if user has provided sys_deri) and
sys_dtau_provided (true if user has provided sys_dtau).

funcs=set_funcs(...
'sys_rhs',neuron_sys_rhs,...
'sys_tau',@()[5,6,7],...
'sys_deri',@neuron_sys_deri) %#ok<NOPTS>

funcs =
sys_rhs: [function_handle]
sys_ntau: @()0
sys_tau: @()[5,6,7]
sys_cond: @dummy_cond
sys_deri: @neuron_sys_deri
sys_dtau: @(it,x,p,nx,np)df_derit(funcs,it,x,p,nx,np)
sys_mfderi: [function_handle]
x_vectorized: 0
tp_del: 0
sys_deri_provided: 1
sys_dtau_provided: 0
sys_mfderi_provided: 0

Save and continue to continuation and stability of steady states demo1_stst.html

save('demo1_funcs_results.mat');

Published with MATLAB 7.14

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_funcs.html 2/3
7/25/2017 Definition of user functions

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_funcs.html 3/3
7/25/2017 Continuation and stability of steady states (equilibria)

Continuation and stability of steady states (equilibria)

(c) DDE-BIFTOOL v. 3.1.1(75), 31/12/2014

Once the user-defined functions are prepared, DDE-Biftool can compute and continue equilibria of the DDE, and compute their
linearized stability, thus detecting local bifurcations. This demo requires demo1_funcs.html to have run beforehand.

Contents
Initial guess for steady state
Linear stability of initial equilibrium
Ask for roots with more negative real part
Figures: Spectrum of equilibrium
Initialize branch of trivial equilibria
Extend and continue branch of trivial equilibria
Stability of branch of equilibria
Figures: Stability of equilibria
Save and continue with Hopf bifurcations: demo1_hopf.html

%#ok<*ASGLU,*NOPTS,*NASGU>
%

Initial guess for steady state

It is clear that the neuron DDE has a steady state solution for all values of the parameters. We define a first
steady state solution using the parameter values , , , , and . Remember
that we chose par .

stst.kind='stst';
stst.parameter=[1/2, -1, 1, 2.34, 0.2, 0.2, 1.5];
stst.x=[0;0]

stst =
kind: 'stst'
parameter: [0.5 -1 1 2.34 0.2 0.2 1.5]
x: [2x1 double]

Linear stability of initial equilibrium


We get default point method parameters and correct the point, which, being already a correct solution, remains unchanged.
Computing and plotting stability of the corrected point reveals it has one unstable real mode, see figure.

flag_newhheur=1; % flag_newhheur=1 is the default choice if this argument is omitted


method=df_mthod(funcs,'stst',flag_newhheur);
method.stability.minimal_real_part=-1
[stst,success]=p_correc(funcs,stst,[],[],method.point)
% compute its stability:
stst.stability=p_stabil(funcs,stst,method.stability)

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_stst.html 1/7
7/25/2017 Continuation and stability of steady states (equilibria)
figure(1); clf;
p_splot(stst); % plot its stability:

method =
continuation: [1x1 struct]
bifurcation: [1x1 struct]
point: [1x1 struct]
stability: [1x1 struct]
stst =
kind: 'stst'
parameter: [0.5 -1 1 2.34 0.2 0.2 1.5]
x: [2x1 double]
success =
1
stst =
kind: 'stst'
parameter: [0.5 -1 1 2.34 0.2 0.2 1.5]
x: [2x1 double]
stability: [1x1 struct]

Ask for roots with more negative real part


In both figures, approximations and corrections are nearly indistinguishable.

method.stability.minimal_real_part=-2;
stst.stability=p_stabil(funcs,stst,method.stability); % recompute stability:
figure(2); clf;
p_splot(stst); % replot stability

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_stst.html 2/7
7/25/2017 Continuation and stability of steady states (equilibria)

Figures: Spectrum of equilibrium


Approximated and corrected roots of the characteristic equation of neuron system at its steady state solution
. Real parts computed up to (top), (bottom).

Initialize branch of trivial equilibria


We will use this point as a first point to compute a branch of steady state solutions. First, we obtain an empty branch with free
parameter , limited by and between points.

% get an empty branch with ind_a21 as a free parameter:


branch1=df_brnch(funcs,ind_a21,'stst')
branch1.parameter
branch1.parameter.min_bound
% set bounds for continuation parameter
branch1.parameter.min_bound(1,:)=[ind_a21 0];
branch1.parameter.max_bound(1,:)=[ind_a21 5];
branch1.parameter.max_step(1,:)=[ind_a21 0.2];
% use stst as a first branch point:
branch1.point=stst;

branch1 =
method: [1x1 struct]
parameter: [1x1 struct]
point: []
ans =
free: 4
min_bound: [3x2 double]
max_bound: []
max_step: []

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_stst.html 3/7
7/25/2017 Continuation and stability of steady states (equilibria)
ans =
5 0
6 0
7 0

Extend and continue branch of trivial equilibria


To obtain a second starting point we change parameter value slightly and correct again.Because we know how the branch of
steady state solutions continued in looks like (it is constant at ) we disable plotting during continuation by
setting the corresponding continuation method parameter to zero.

stst.parameter(ind_a21)=stst.parameter(ind_a21)+0.1;
[stst,success]=p_correc(funcs,stst,[],[],method.point)
% use as a second branch point:
branch1.point(2)=stst;
branch1.method.continuation.plot=0;

% continue in one direction:


[branch1,s,f,r]=br_contn(funcs,branch1,100)
% turn the branch around:
branch1=br_rvers(branch1);
% continue in the other direction:
[branch1,s,f,r]=br_contn(funcs,branch1,100)

stst =
kind: 'stst'
parameter: [0.5 -1 1 2.44 0.2 0.2 1.5]
x: [2x1 double]
stability: []
success =
1
BR_CONTN warning: boundary hit.
branch1 =
method: [1x1 struct]
parameter: [1x1 struct]
point: [1x16 struct]
s =
15
f =
0
r =
0
BR_CONTN warning: boundary hit.
branch1 =
...

Stability of branch of equilibria


During continuation, sixteen points were successfully computed ( ) before the right boundary was hit (signalled by a
warning). No corrections failed ( ) and no computed points were later rejected ( ). Reversing the order of the branch
points allows to continue to the left.

After obtaining suitable measure structures we plot the real part of the approximated and corrected roots of the characteristic
equation along the branch, (see figure). Notice the strange behaviour (coinciding of several complex pairs of roots) at . At
this parameter value one of the couplings between the neurons is broken. In fact, for , the evolution of the second
component is independent of the evolution of the first.

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_stst.html 4/7
7/25/2017 Continuation and stability of steady states (equilibria)

branch1.method.stability.minimal_real_part=-2;
branch1=br_stabl(funcs,branch1,0,0);

% obtain suitable scalar measures to plot stability along branch:


[xm,ym]=df_measr(1,branch1)
figure(3); clf;
br_plot(branch1,xm,ym,'b'); % plot stability along branch:
ym.subfield='l0';
br_plot(branch1,xm,ym,'c');
plot([0 5],[0 0],'-.');
axis([0 5 -2 1.5]);
xlabel('a21');ylabel('\Re\lambda');
% plot stability versus point number:
figure(4); clf;
br_plot(branch1,[],ym,'b');
br_plot(branch1,[],ym,'b.');
plot([0 30],[0 0],'-.');
xlabel('point number along branch');ylabel('\Re(\lambda)');

xm =
field: 'parameter'
subfield: ''
row: 1
col: 4
func: ''
ym =
field: 'stability'
subfield: 'l1'
row: 'all'
col: 1
func: 'real'

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_stst.html 5/7
7/25/2017 Continuation and stability of steady states (equilibria)

Figures: Stability of equilibria

Real parts of the approximated (top) and corrected (top,bottom) roots of the characteristic equation versus (top) respectively the
point number along the branch (bottom).

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_stst.html 6/7
7/25/2017 Continuation and stability of steady states (equilibria)

Save and continue with Hopf bifurcations: demo1_hopf.html

save('demo1_stst_results.mat');

Published with MATLAB 7.14

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_stst.html 7/7
7/25/2017 Hopf bifurcation

Hopf bifurcation

(c) DDE-BIFTOOL v. 3.1.1(75), 31/12/2014

The eigenvalues of the linearized system along branches of equilibria indicate potential bifurcations. In this demo complex
conjugate pairs of eigenvalues cross the imaginary axis, corresponding to Hopf bifurcations. The demo will proceed to continue two
of these Hopf bifurcations in two system parameters and . This part requires to run demo1_stst.html first

Contents
Locating the first Hopf point
Figure: eigenvalues at Hopf point
Initialize and continue first Hopf bifurcation
Figure: Continuation (predictions and corrections) of Hopf bifurcation
Hopf continuation and detecton of Takens-Bogdanov point
Figures: Stability and frequency along first Hopf bifurcation
Comments
Switch to second Hopf bifurcation at double Hopf bifurcation
Changing the Newton iteration and correction with other system parameter
Continuation of second Hopf bifurcation
Figure: Continuation (predictions and corrections) of both Hopf bifurcations
Save and continue

%#ok<*ASGLU,*NOPTS,*NASGU>
%

Locating the first Hopf point


Where eigenvalue curves in the stability plot (see demo1_stst.html#stststability) cross the zero line, bifurcations occur. If we want to
compute the Hopf bifurcation near we need its point number. This is most easily obtained by plotting the stability versus
the point numbers along the branch. We select the last point with positive eigenvalues and turn it into an (approximate) Hopf
bifurcation point. We correct the Hopf point using appropriate method parameters and one free parameter ( ). We then copy the
corrected point to keep it for later use. Computing and plotting stability of the Hopf point clearly reveals the pair of purely imaginary
eigenvalues.

ind_hopf=find(arrayfun(@(x)real(x.stability.l0(1))>0,branch1.point),1,'last');
hopf=p_tohopf(funcs,branch1.point(ind_hopf));
method=df_mthod(funcs,'hopf',flag_newhheur); % get hopf calculation method parameters:
method.stability.minimal_real_part=-1;
[hopf,success]=p_correc(funcs,hopf,ind_a21,[],method.point) % correct hopf
first_hopf=hopf; % store hopf point in other variable for later use
hopf.stability=p_stabil(funcs,hopf,method.stability); % compute stability of hopf point
figure(5); clf;
p_splot(hopf); % plot stability of hopf point

hopf =
kind: 'hopf'
parameter: [0.5 -1 1 0.807123224967979 0.2 0.2 1.5]
x: [2x1 double]
v: [2x1 double]
http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_hopf.html 1/8
7/25/2017 Hopf bifurcation
omega: 0.78196516212093
success =
1

Figure: eigenvalues at Hopf point


Characteristic roots at Hopf point: a pair of pure imaginary eigenvalues is clearly visible.

Initialize and continue first Hopf bifurcation


In order to follow a branch of Hopf bifurcations in the two parameter space we again need two starting points. Hence we
use the Hopf point already found and one perturbed in and corrected in , to start on a branch of Hopf bifurcations. For the free
parameters, and , we provide suitable intervals, and , and maximal stepsizes, for and for .
We continue the branch on both sides by an intermediate order reversal and a second call to br_contn.

branch2=df_brnch(funcs,[ind_a21,ind_taus],'hopf'); % use hopf point as first point of hopf branch:


branch2.parameter.min_bound(1,:)=[ind_a21 0];
branch2.parameter.max_bound(1:2,:)=[[ind_a21 4]' [ind_taus 10]']';
branch2.parameter.max_step(1:2,:)=[[ind_a21 0.2]' [ind_taus 0.5]']';
branch2.point=hopf;

hopf.parameter(ind_taus)=hopf.parameter(ind_taus)+0.1; % perturb hopf point


[hopf,success]=p_correc(funcs,hopf,ind_a21,[],method.point); % correct hopf point, recompute stability
branch2.point(2)=hopf; % use as second point of hopf branch:
figure(6); clf;
[branch2,s,f,r]=br_contn(funcs,branch2,40); % continue with plotting hopf branch:
branch2=br_rvers(branch2); % reverse Hopf branch
[branch2,s,f,r]=br_contn(funcs,branch2,30); % continue in other direction
xlabel('a21');ylabel('tau_s');

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_hopf.html 2/8
7/25/2017 Hopf bifurcation

BR_CONTN warning: boundary hit.


BR_CONTN warning: boundary hit.
BR_CONTN warning: boundary hit.
BR_CONTN warning: boundary hit.

Figure: Continuation (predictions and corrections) of Hopf bifurcation


Predictions and corrections in the -plane after computation of a first branch of Hopf bifurcations.

Hopf continuation and detecton of Takens-Bogdanov point


As we did not change continuation method parameters, predictions and corrections will be plotted during continuation. The final
result is shown as figure. At the top, the branch hits the boundary . To the right, however, it seemingly turned back onto
itself. We compute and plot stability along the branch.

branch2=br_stabl(funcs,branch2,0,0);
figure(7); clf;
[xm,ym]=df_measr(1,branch2); % plot stability versus point number:
ym.subfield='l0';
br_plot(branch2,[],ym,'c');
ym.subfield='l1';
br_plot(branch2,[],ym,'b');
xlabel('point number along branch');ylabel('\Re(\lambda)');
% plot omega to identify 'false' turning point
% as Bogdanov-Takens point:
figure(8); clf;
[xm,ym]=df_measr(0,branch2);
ym
ym.field='omega';
ym.col=1;
xm

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_hopf.html 3/8
7/25/2017 Hopf bifurcation
xm.col=7;
br_plot(branch2,xm,ym,'c');
grid on;
xlabel('tau_s');ylabel('Hopf frequency \omega');

ym =
field: 'parameter'
subfield: ''
row: 1
col: 7
func: ''
xm =
field: 'parameter'
subfield: ''
row: 1
col: 4
func: ''

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_hopf.html 4/8
7/25/2017 Hopf bifurcation

Figures: Stability and frequency along first Hopf bifurcation


Real part of characteristic roots along the first branch of Hopf bifurcations (top). Bottom: The frequency of the Hopf bifurcation along
the same branch.

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_hopf.html 5/8
7/25/2017 Hopf bifurcation

Comments
If, during these computations we would have obtained warnings of the kind, TIME_H warning: h_min is reached, it would
indicate that the time integration step required to obtain good approximations to the requested rightmost characteristic roots is too
small. By default, characteristic roots are computed up to . We also notice a double Hopf point on the left but nothing
special at the right end, which could explain the observed turning of the branch. Plotting the frequency versus reveals what has
happened, see figure. For small , goes through zero, indicating the presence of a Bogdanov-Takens point. The subsequent
turning is a recomputation of the same branch with negative frequencies.

Switch to second Hopf bifurcation at double Hopf bifurcation


Selecting the double Hopf point we produce an approximation of the second Hopf point.

ind_hopf2=find(arrayfun(...
@(x)numel(x.stability.l0)>=5&&real(x.stability.l0(5))<-1e-4,branch2.point),...
1,'first');
hopf2=p_tohopf(funcs,branch2.point(ind_hopf2));
method.point.print_residual_info=1;
[hopf,success]=p_correc(funcs,hopf2,ind_a21,[],method.point) %fails

it=1, res=0.00834454
it=2, res=0.460349
it=3, res=0.0546203
it=4, res=0.00153245
it=5, res=1.96637e-05
hopf =
kind: 'hopf'
parameter: [0.5 -1 1 -0.0103306962446629 0.2 0.2 8.55313930216643]
x: [2x1 double]
v: [2x1 double]
omega: 0.976827672655547
success =
0

Changing the Newton iteration and correction with other system parameter
However, the correction fails. Printing residual information gives a list of the Newton iteration number and the norm of the residual.
This reveals at least temporarily divergence of the correction process. Or we did not allow enough Newton iterations, or the free
parameter is not so appropriate. We successfully try again using as a free parameter.

[hopf,success]=p_correc(funcs,hopf2,ind_taus,[],method.point) % should now work

it=1, res=0.00834454
it=2, res=0.000618872
it=3, res=2.10605e-07
it=4, res=3.91466e-13
hopf =
kind: 'hopf'
parameter: [0.5 -1 1 0.206568018737126 0.2 0.2 8.63403521750747]
x: [2x1 double]
v: [2x1 double]
omega: 0.915807193195807
success =
1

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_hopf.html 6/8
7/25/2017 Hopf bifurcation

Continuation of second Hopf bifurcation


Using the second Hopf point we compute the intersecting branch of Hopf points, depicted below. Setting plot_progress to zero
disables intermediate plotting such that we see only the end result.

branch3=df_brnch(funcs,[ind_a21,ind_taus],'hopf');
branch3.parameter=branch2.parameter;
branch3.point=hopf;
% perturb and correct:
hopf.parameter(ind_a21)=hopf.parameter(ind_a21)-0.05;
method.point.print_residual_info=0;
format short;
[hopf,success]=p_correc(funcs,hopf,ind_taus,[],method.point);
branch3.point(2)=hopf; % use as second branch point:
% continue branch of hopf points on two sides:
branch3.method.continuation.plot_progress=0;
figure(6);
[branch3,s,f,r]=br_contn(funcs,branch3,100);
% reverse branch
branch3=br_rvers(branch3);
[branch3,s,f,r]=br_contn(funcs,branch3,100);

BR_CONTN warning: boundary hit.


BR_CONTN warning: boundary hit.

Figure: Continuation (predictions and corrections) of both Hopf bifurcations


Predictions and corrections in the -plane after computation of second branch of Hopf bifurcations (superimposed on result of
first Hopf bifurcation).

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_hopf.html 7/8
7/25/2017 Hopf bifurcation

Save and continue


Continue with with periodic orbits demo1_psol.html or normal forms demo1_normalforms.html.

save('demo1_hopf_results.mat');

Published with MATLAB 7.14

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_hopf.html 8/8
7/25/2017 Normal form calculations along Hopf bifurcation curves

Normal form calculations along Hopf bifurcation curves

Using the normal form extension nmfm by Bram Wage.

Warning Automatic bifurcation detection along branches is still in development. Its interface is likely to change, and detection is not
yet reliable. With br_bifdet, normal form computations do not return error estimates. Thus, they should only be used with user-
provided sys_mfderi for higher-order derivatives (in contrast to the default finite-difference approximation mf_deriv). See
demo1_simple.html for an illustration, how one can perform a subset of the br_bifdet functionality with finite-difference
approximations and error estimates.

(c) DDE-BIFTOOL v. 3.1.1(72), 30/12/2014

This demo requires to run demo1_hopf.html first.

Contents
Load folder with normal form tools into matlab path
Higher-order derivatives provided by user
Automatic detection of codimension 2 bifurcations and criticality
Check Criticality
Special points
Perform bifurcation detection along second Hopf branch
Plot of Lyapunov coefficients for both Hopf branches
Special points along branch3
Save and continue with periodic orbit continuation: demo1_psol.html

%#ok<*ASGLU,*NOPTS,*NASGU>
%

Load folder with normal form tools into matlab path

addpath('../../ddebiftool_extra_nmfm/');

Higher-order derivatives provided by user


Normal form calculations require higher-order derivatives. The user can (should!) provide them in the form of a function

function y=sys_mfderi(xx,par,v1,v2,...)

where y=D^m_1f(xx,p)[v1,v2,...]. The inputs xx, v1, v2 are n x (ntau+1) arrays, par the system parameters. The output is the
directional derivative of order m, where m is the the number of arguments vk (k=1..m).

For this example, an explicit function for sys_mfderi is given, so we use it by adding the function to the function structure:

afuncs=set_funcs(funcs,'sys_mfderi',@sys_mfderi)

afuncs =
sys_rhs: [function_handle]

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_normalforms.html 1/8
7/25/2017 Normal form calculations along Hopf bifurcation curves
sys_ntau: @()0
sys_tau: @()[5,6,7]
sys_cond: @dummy_cond
sys_deri: @neuron_sys_deri
sys_dtau: @(it,x,p,nx,np)df_derit(funcs,it,x,p,nx,np)
sys_mfderi: @sys_mfderi
x_vectorized: 0
tp_del: 0
sys_deri_provided: 1
sys_dtau_provided: 0
sys_mfderi_provided: 1

Automatic detection of codimension 2 bifurcations and criticality


The nmfm extension provides br_bifdet, which determines Lyapunov cofficients, and codimension-two points along Hopf
bifurcation curves.

The output branch_nmfm has a point array of structures that contain additional fields 'nmfm', 'nvec', 'flag'. The field 'flag'
may have the values

'' (empty): this point is not special,


'hoho': this point is a double-Hopf point,
'zeho': this point is a zero-Hopf point,
'genh': this point is a generalized (degenerate/Bautin) Hopf point.

The field 'nmfm' is a structure. If the branch was a Hopf curve, it contains the field

'L1': the first (3rd-order) Lyapunov coefficient at the Hopf point (L1<0 implies that the Hopf bifurcation is supercritical, L1>0
implies that the Hopf bifuration is subcritical).
for special points it contains other normal form coefficients, determining the sub-case of the bifurcation. See Kuznetsov (2004)
'Elements of Applied Bifurcation Theory') for notation and definitions.

branch2_nmfm=br_bifdet(afuncs,branch2);

BR_BIFDET: hoho point found at par(4) = 0.2072962661, par(7) = 8.6340742204.


BR_BIFDET: omega1 = 0.3287154066, omega2 = 0.9157115877, par(4) = 0.2072962661, par(7) = 8.6340742204.
BR_BIFDET: Unable to correct as hoho point near par(4) = 0.1234.
BR_BIFDET: hoho point found at par(4) = 0.0000000000, par(7) = 2.4183994947.
BR_BIFDET: omega1 = 0.8660253477, omega2 = 0.8660253477, par(4) = 0.0000000000, par(7) = 2.4183994947.

Check Criticality
The Lyapunov coefficients are always negative along the branch, implying that the bifurcation is supercritical.

L1_br2=arrayfun(@(x)x.nmfm.L1,branch2_nmfm.point);
taus_br2=arrayfun(@(x)x.parameter(ind_taus),branch2_nmfm.point);
a21_br2=arrayfun(@(x)x.parameter(ind_a21),branch2_nmfm.point);
figure(17);
subplot(2,1,1);
plot(taus_br2,a21_br2,'.-');
grid on
xlabel('\tau_s');
ylabel('a_{21}');

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_normalforms.html 2/8
7/25/2017 Normal form calculations along Hopf bifurcation curves
title('(Repeated) two-parameter Hopf curve branch2');
subplot(2,1,2);
plot(taus_br2,L1_br2,'.-');
set(gca,'ylim',[-1,0]);
grid on
xlabel('\tau_s');
ylabel('L1');
title('First Lyapunov coefficient along branch2');

Special points
The detection routine br_bifdet finds special points, listed by br_getflags. Each row index corresponds to a type of point.
Indices can be converted to point types (strings) with num2bif.

The call to br_getflags shows that br_bifdet has found two Hopf-Hopf points. Double-checking the data in the 'nmfm' field
shows that one of them is genuine, the other is spurious (a non-semisimple Hopf eigenvalue when a21=0). A typical feature of
DDEs is that apparently higher-codimension degeneracies can occur due to the finite number of delays and equations.

The points at which the Lyapunov coefficient L1 becomes singular (infinity) are special points: one of them is the non-semisimple
Hopf eigenvalue point, the other is the Takens-Bogdanov point (where the Hopf frequency omega passes through 0). At the moment
br_bifdet cannot detect Takens-Bogdanov points safely.

special_br2_alltypes=br_getflags(branch2_nmfm)
knowntypes=num2bif();
biftype=num2bif(find(any(br_getflags(branch2_nmfm)>0,2)))
special_br2=special_br2_alltypes(bif2num(biftype),:)
for i=1:length(special_br2);
fprintf('\nPoint %d normal form parameters:\n',special_br2(i));
disp(branch2_nmfm.point(special_br2(i)).nmfm);
fprintf('\nPoint %d Eigenvalues:\n',special_br2(i));

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_normalforms.html 3/8
7/25/2017 Normal form calculations along Hopf bifurcation curves
disp(branch2_nmfm.point(special_br2(i)).stability.l0);
end

special_br2_alltypes =
0 0
0 0
0 0
0 0
0 0
4 19
known point types:
type 0: stst
type 1: hopf
type 2: fold
type 3: psol
type 4: hcli
type 5: genh
type 6: hoho
type 7: zeho
biftype =
hoho
special_br2 =
4 19

Point 4 normal form parameters:


L1: -0.0127
g2100: -0.0042 - 0.0013i
g1011: -0.0091 - 0.0029i
g1110: -0.0158 + 0.0053i
g0021: -0.0086 + 0.0029i
theta: 1.0605
delta: 3.7719

Point 4 Eigenvalues:
0.1284 - 0.2509i
0.1284 + 0.2509i
0.0000 - 0.9157i
0.0000 + 0.9157i
-0.0000 - 0.3287i
-0.0000 + 0.3287i
-0.0298 - 1.0012i
-0.0298 + 1.0012i
-0.0662 - 1.6968i
-0.0662 + 1.6968i
-0.0671 - 1.6371i
-0.0671 + 1.6371i
-0.0982 - 2.4063i
-0.0982 + 2.4063i
-0.1095 - 2.3640i
-0.1095 + 2.3640i

Point 19 normal form parameters:


L1: -2.1110e+05
g2100: -1.8281e+05 - 5.4250e+04i
g1011: -3.6563e+05 - 1.0850e+05i
g1110: -3.6563e+05 - 1.0850e+05i
g0021: -1.8281e+05 - 5.4250e+04i
theta: 2.0000
delta: 2

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_normalforms.html 4/8
7/25/2017 Normal form calculations along Hopf bifurcation curves

Point 19 Eigenvalues:
0.0000 - 0.8660i
0.0000 + 0.8660i
0.0000 - 0.8660i
0.0000 + 0.8660i

Perform bifurcation detection along second Hopf branch


Along branch3 we perform normal form computations and codimension-2 detection, too.

branch3_nmfm=br_bifdet(afuncs,branch3);

BR_BIFDET: hoho point found at par(4) = 0.0000000000, par(7) = 9.6735990351.


BR_BIFDET: omega1 = 0.8660252363, omega2 = 0.8660252363, par(4) = 0.0000000000, par(7) = 9.6735990351.
BR_BIFDET: Unable to correct as hoho point near par(4) = 0.1065.
BR_BIFDET: hoho point found at par(4) = 0.2072962626, par(7) = 8.6340742187.
BR_BIFDET: omega1 = 0.9157115883, omega2 = 0.3287154065, par(4) = 0.2072962626, par(7) = 8.6340742187.

Plot of Lyapunov coefficients for both Hopf branches


Again, at a21=0 we have a non-semisimple Hopf eigenvalue such that the Lyapunov coefficient tends to infinity. Otherwise, the
Lyapunov coefficient is negative such that the Hopf bifurcation is supercritical.

L1_br3=arrayfun(@(x)x.nmfm.L1,branch3_nmfm.point);
a21_br3=arrayfun(@(x)x.parameter(ind_a21),branch3_nmfm.point);
taus_br3=arrayfun(@(x)x.parameter(ind_taus),branch3_nmfm.point);
figure(18);
subplot(2,2,1);
plot(a21_br2,taus_br2,'.-',a21_br3,taus_br3,'.-');
a21lim=get(gca,'xlim');
tauslim=get(gca,'ylim');
grid on
xlabel('a_{21}');
ylabel('\tau_s');
title('(Repeated) two-parameter Hopf curves');
subplot(2,2,2);
plot(L1_br2,taus_br2,'.-');
set(gca,'ylim',tauslim,'xlim',[-0.6,0]);
grid on
ylabel('\tau_s');
xlabel('L1');
title('First Lyapunov coefficient along branch2');
subplot(2,2,3);
plot(a21_br3,L1_br3,'.-','color',[0,0.5,0]);
set(gca,'ylim',[-0.1,0],'xlim',a21lim);
grid on
xlabel('a_{21}');
ylabel('L1');
title('First Lyapunov coefficient along branch3');

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_normalforms.html 5/8
7/25/2017 Normal form calculations along Hopf bifurcation curves

Special points along branch3


Only the Hopf-Hopf point already known from branch2 and the spurious Hopf-Hopf point at a21=0 are detected as codimension-2
points.

special_br3_alltypes=br_getflags(branch3_nmfm)
biftype=num2bif(find(any(br_getflags(branch3_nmfm)>0,2)))
special_br3=special_br3_alltypes(bif2num(biftype),:)
for i=1:length(special_br3)
fprintf('\nPoint %d normal form parameters:\n',special_br3(i));
disp(branch3_nmfm.point(special_br3(i)).nmfm);
fprintf('\nPoint %d Eigenvalues:\n',special_br3(i));
disp(branch3_nmfm.point(special_br3(i)).stability.l0);
end

special_br3_alltypes =
0 0
0 0
0 0
0 0
0 0
3 12
biftype =
hoho
special_br3 =
3 12

Point 3 normal form parameters:


L1: -6.5295e+03
g2100: -5.6547e+03 - 4.8135e+02i
g1011: -1.1309e+04 - 9.6271e+02i

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_normalforms.html 6/8
7/25/2017 Normal form calculations along Hopf bifurcation curves
g1110: -1.1309e+04 - 9.6271e+02i
g0021: -5.6547e+03 - 4.8135e+02i
theta: 2.0000
delta: 2.0000

Point 3 Eigenvalues:
0.0501 - 0.2766i
0.0501 + 0.2766i
0.0501 - 0.2766i
0.0501 + 0.2766i
0.0000 - 0.8660i
0.0000 + 0.8660i
0.0000 - 0.8660i
0.0000 + 0.8660i
-0.0459 - 1.4920i
-0.0459 + 1.4920i
-0.0459 - 1.4920i
-0.0459 + 1.4920i
-0.0801 - 2.1310i
-0.0801 + 2.1310i
-0.0801 - 2.1310i
-0.0801 + 2.1310i

Point 12 normal form parameters:


L1: -0.0094
g2100: -0.0086 + 0.0029i
g1011: -0.0158 + 0.0053i
g1110: -0.0091 - 0.0029i
g0021: -0.0042 - 0.0013i
theta: 3.7719
delta: 1.0605

Point 12 Eigenvalues:
0.1284 - 0.2509i
0.1284 + 0.2509i
0.0000 - 0.9157i
0.0000 + 0.9157i
0.0000 - 0.3287i
0.0000 + 0.3287i
-0.0298 - 1.0012i
-0.0298 + 1.0012i
-0.0662 - 1.6968i
-0.0662 + 1.6968i
-0.0671 - 1.6371i
-0.0671 + 1.6371i
-0.0982 - 2.4063i
-0.0982 + 2.4063i
-0.1095 - 2.3640i
-0.1095 + 2.3640i

Save and continue with periodic orbit continuation: demo1_psol.html


See also demo1_simple.html for an illustration, how to use ddebiftool_utilities to perform a subset of the above computations
without user-provided derivatives.

save('demo1_normalforms_results.mat');

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_normalforms.html 7/8
7/25/2017 Normal form calculations along Hopf bifurcation curves

Published with MATLAB 7.14

http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_normalforms.html 8/8

Você também pode gostar