-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_plot_bf.m
45 lines (39 loc) · 1.64 KB
/
main_plot_bf.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
%% Plot bifurcation diagram
% Get the x values (parameter) and y values (state) of the bifurcation
% curve.
par_stst=getpar(stst_branch_wbifs,contpar);
y_stst=getx(stst_branch_wbifs,no_y);
% Get the x values (parameter) and y values (state) of the bifurcation
% points.
par_bf_hopf = bgetpar(stst_branch_wbifs,contpar,'hopf');
y_bf_hopf = bgetx(stst_branch_wbifs,no_y,'hopf');
% Create a figure.
fig_bf = figure('Name',append('Bifurcation diagram for ',namepar),'NumberTitle','off');
clf;
ax1=gca;
hold on;
% Plot the stable branch.
plot(ax1,par_stst(nunst_stst==0),y_stst(nunst_stst==0),'g.','DisplayName','stable');
% Plot the unstable branch.
plot(ax1,par_stst(nunst_stst>0),y_stst(nunst_stst>0),'b.','DisplayName','unstable');
% Plot the bifurcation point.
plot(ax1,par_bf_hopf,y_bf_hopf,'ks','DisplayName','hopf');
legend(ax1,'location','north');
xlabel(ax1,namepar);
ylabel(ax1,label_y);
title(ax1,sprintf(append('Bifurcation diagram for ',namepar)));
% %% Plot bifurcation diagram
% par_stst=getpar(stst_branch_wbifs,contpar);
% E1_stst=getx(stst_branch_wbifs,1);
% fig_bf = figure('Name',append('Bifurcation diagram for ',namepar),'NumberTitle','off');
% clf;
% ax1=gca;
% hold on;
% plot(ax1,par_stst(nunst_stst==0),E1_stst(nunst_stst==0),'g.','DisplayName','stable');
% plot(ax1,par_stst(nunst_stst>0),E1_stst(nunst_stst>0),'b.','DisplayName','unstable');
% plot(ax1,bgetpar(stst_branch_wbifs,contpar,'hopf'),bgetx(stst_branch_wbifs,1,'hopf'),'ks','DisplayName','hopf');
%
% legend(ax1,'location','north');
% xlabel(ax1,namepar);
% ylabel(ax1,'E1');
% title(ax1,sprintf(append('Bifurcation diagram for ',namepar)));