SetupTorusBifurcation - Initialize continuation of torus or period doubling bifurcations

Contents

function [trfuncs,trbranch,suc]=SetupTorusBifurcation(funcs,branch,ind,varargin)

Inputs

optional inputs

all other named arguments are passed on to trbranch.method.continuation, trbranch.method.point and trbranch.parameter

Outputs

(c) DDE-BIFTOOL v. 3.1.1(20), 11/04/2014

process options

default={'contpar',[],'sys_deri',1e-4,'correc',true,'dir',[],'step',1e-3,...
    'hjac',1e-4,'nremove',1};
[options,pass_on]=dde_set_options(default,varargin,'pass_on');
if isfield(funcs,'sys_deri_provided') && funcs.sys_deri_provided
    options.sys_deri=funcs.sys_deri;
end
if funcs.tp_del && isfield(funcs,'sys_dtau_provided') && funcs.sys_dtau_provided
    options.sys_dtau=funcs.sys_dtau;
end
branch.point=branch.point(ind);

initialize branch of torus bifurcations (trbranch) and pass on optional args

trbranch=replace_branch_pars(branch,options.contpar,pass_on);

set up numbering and values of additional parameters

point=trbranch.point;
if isfield(point,'stability')
    point=rmfield(point,'stability');
end
dim=size(point.profile,1);    % dimension of original problem
npar=length(point.parameter); % number of original system parameters
omega_ind=npar+1;             % location of add. parameter omega
period_ind=npar+2;            % location of add. parameter (equal to period)

set up functions of extended system

trfuncs=funcs;
trfuncs.get_comp=@(p,component)extract_from_tr(p,component);
if ~funcs.tp_del

constant delays

    tau_ind=funcs.sys_tau();
    trfuncs.sys_rhs=@(x,p)sys_rhs_TorusBif(x,p(1:npar),...
        p(omega_ind),p(period_ind),[0,p(tau_ind)],...
        funcs.sys_rhs,dim,options.sys_deri);
    trfuncs.sys_deri=@(x,p,nx,np,v)...
        sys_deri_TorusBif(x,p,nx,np,v,options.hjac,omega_ind,period_ind,dim,...
        funcs,struct('sys_rhs',trfuncs.sys_rhs));
else

state dependent delay

    n_orig_tau=funcs.sys_ntau();  % number of state-dependent delays
    % additional delays needed for extended system:
    xtau_ind=tauSD_ext_ind(n_orig_tau);
    trfuncs.sys_rhs=@(x,p)sys_rhs_SD_TorusBif(x,p(1:npar),...
        p(omega_ind),p(period_ind),...
        funcs.sys_rhs,funcs.sys_tau,options.sys_deri,options.sys_dtau,dim,xtau_ind);
    trfuncs.sys_ntau=@()n_orig_tau*(n_orig_tau+1);
    trfuncs.sys_deri=@(x,p,nx,np,v)...
        df_deriv(struct('sys_rhs',trfuncs.sys_rhs),x,p,nx,np,v,options.hjac);
    trfuncs.sys_deri_provided=false;
    trfuncs.sys_tau=@(itau,x,p)sys_tau_SD_PObif(itau,x,p(1:npar),funcs.sys_tau,dim,xtau_ind);
    trfuncs.sys_dtau=@(itau,x,p,nx,np)sys_dtau_SD_PObif(itau,x,p,nx,np,funcs.sys_dtau,...
        dim,xtau_ind);
end
trfuncs.sys_cond=@(p)sys_cond_TorusBif(p,funcs.sys_cond,dim,period_ind,...
    trfuncs.get_comp);

required amendments of structures for extended system

trbranch.parameter.free=[trbranch.parameter.free,omega_ind,period_ind];
trbranch.method.point.extra_condition=1;

create initial guess for correction

trini0=TorusInit(funcs,point,branch.method,options.nremove);
[trbranch,suc]=correct_ini(trfuncs,trbranch,trini0,...
    options.dir,options.step,options.correc);
end