-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHopf_Limit_Circle.m
executable file
·64 lines (58 loc) · 2.56 KB
/
Hopf_Limit_Circle.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
% Copyright 2021 Aix-Marseille Université
% "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. "
function Hopf_Limit_Circle(path,folder,file,nb_variable,nb_H,MaxStepsize,MinStepsize,MaxNumPoints_forward)
global name_variable
file = matfile(path+"/"+file);
x = file.x;
s = file.s(nb_H,:);
if ~strcmp(s.label,'H ')
return;
end
[UserInfo,pvec,syshandle] = start_analyse(path,folder,nb_variable);
xinit=x(1:6,s.index);
pvec(nb_variable)=x(end,s.index);
ap=nb_variable; % Denote 'active' parameter for continuation
%%%%% Initialize continuation %%%%%
[x0,v0]=init_H_LC(syshandle, xinit, pvec', ap,MaxStepsize,30,4); %Initialize equilibrium
%%%%% Initialize Matcont options %%%%%
opt=contset;
opt=contset(opt,'MaxNumPoints',MaxNumPoints_forward); %Set numeber of continuation steps
opt=contset(opt,'MaxStepsize',MaxStepsize); %Set max step size
opt=contset(opt,'MinStepsize',MinStepsize);%Set min step size
opt=contset(opt,'Singularities',1); %Monitor singularities
opt=contset(opt,'Eigenvalues',1); %Output eigenvalues
opt=contset(opt,'InitStepsize',MaxStepsize/10.0); %Set Initial stepsize
opt=contset(opt,'Userfunctions',1);%Set userfunction is used
opt=contset(opt,'UserfunctionsInfo',UserInfo); %define info of user function
% opt=contset(opt,'Backward',1); %Compute backward
%%%%% Continuation %%%%%
[x1,v1,s1,h1,f1]=cont(@limitcycle,x0,v0,opt); %Equilibrium continuation
save(path+"/"+folder+"/"+name_variable(nb_variable)+'_precision.mat','x1','v1','s1','h1','f1')
%%
%%%%%%% Default parameter for the figure
set(groot,'defaultAxesFontSize',25)
set(groot,'defaultTextFontSize',25)
set(groot,'defaultLineLineWidth',2)
set(groot,'defaultAxesXGrid','on')
set(groot,'defaultAxesYGrid','on')
x0=10;
y0=10;
width=1550;
height=1400;
set(groot,'defaultFigureUnits','points')
set(groot,'defaultFigurePosition',[x0,y0,width,height])
%%%%% Simplest figure
f(1)=figure('Name','v_e vs v_i','NumberTitle','off');
plotcycle(x1,v1,s1,[size(x1,1) 1 2]);
title('v_e vs v_i')
xlabel('parameter')
ylabel('v_e in KHz')
zlabel('v_i in kHz')
f(2)=figure('Name','v_e vs v_i 2 ','NumberTitle','off');
plotcycle(x1,v1,s1,[1 2]);
title('v_e vs v_i')
ylabel('v_e in KHz')
zlabel('v_i in kHz')
%% save figures
savefig(f,path+"/"+folder+"/"+name_variable(nb_variable)+'_precision.fig')
close(f)