-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotxppautset2.m
159 lines (138 loc) · 4.98 KB
/
plotxppautset2.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
function options=plotxppautset2(varargin)
% PLOTXPPAUTSET2 Create or update an option structure to specify the line properties of each
% type of solution branch in a 1-parameter bifurcation diagram to be
% plotted by plotxppaut2. Defaults are set to mimic XPPAUT appearance.
%
% optionStruct=PLOTXPPAUTSET2('Name','Value')
%
% Where 'Name' and 'Value' are line properties: type plotxppautset2 for
% defaults.
%
% See also plotxppaut2 plotxppaut1 plotxppautset1 plotnullclines
% index of type of curve:
% 1-LP, 2-SNP, 3-HB, 4-TR?, 5-BR, 6-PD, 7-UZ/FP?
% Print out possible values of properties.
if (nargin == 0) && (nargout == 0)
fprintf('Seven entries per option correspond to: \n');
fprintf('Saddle node, Saddle node of Periodics, Hopf, Torus point, Branch point, Period doubling, Fixed period \n');
fprintf(' Color: [ {''k'',''k'',''r'',''b'',''k'',''r'',''b''} ]\n');
fprintf(' LineStyle: [ {''-'',''-'',''none'',''none'',''-'',''none'',''none''} ]\n');
fprintf(' Linewidth: [ {1, 1, 1, 1, 1, 1, 1} ]\n');
fprintf(' Marker: [ {''none'',''none'',''none'',''none'',''none'',''none'',''none''} ]\n');
fprintf(' Markersize: [ {2, 2, 3, 3, 2, 3, 3} ]\n');
fprintf(' MarkerFaceColor: [ {''none'',''none'',''none'',''none'',''none'',''none'',''none''} ]\n');
fprintf(' nSubSample: [1,1,1,1,1,1,1] \n')
fprintf('\n');
return;
end
Names = [
'Color '
'LineStyle '
'Linewidth '
'Marker '
'Markersize '
'MarkerFaceColor '
'nSubSample '
];
m = size(Names,1);
names = lower(Names);
%defaults
%Color -- SHOULD BE VALID MATLAB Color
options.Color.SN = 'k'; %saddle node
options.Color.SNP = 'k'; %saddle node of periodics
options.Color.HB = 'b'; %hopf bifurcation
options.Color.uk1 = 'r'; %
options.Color.uk2 = [0.1,0.7,0.9]; %
options.Color.uk3 = [0.9,0.8,0.1]; %PD
options.Color.FP = 'b'; %fixed period
%LineStyle -- SHOULD BE VALID MATLAB LINESTYLES
options.LineStyle.SN = '-';
options.LineStyle.SNP = '-';
options.LineStyle.HB = '-';
options.LineStyle.uk1 = '-';
options.LineStyle.uk2 = '-';
options.LineStyle.uk3 = '-';
options.LineStyle.FP = '-';
%Linewidths
options.Linewidth.SN = 1;
options.Linewidth.SNP = 1;
options.Linewidth.HB = 1;
options.Linewidth.uk1 = 1;
options.Linewidth.uk2 = 1;
options.Linewidth.uk3 = 1;
options.Linewidth.FP = 1;
%Markersize
options.Marker.SN = 'none';
options.Marker.SNP = 'none';
options.Marker.HB = 'none';
options.Marker.uk1 = 'none';
options.Marker.uk2 = 'none';
options.Marker.uk3 = 'none';
options.Marker.FP = 'none';
%Markersize
options.Markersize.SN = 2;
options.Markersize.SNP = 2;
options.Markersize.HB = 2;
options.Markersize.uk1 = 2;
options.Markersize.uk2 = 2;
options.Markersize.uk3 = 2;
options.Markersize.FP = 2;
%MarkerFaceColor -- SHOULD BE VALID MATLAB Color
options.MarkerFaceColor.SN = 'none';
options.MarkerFaceColor.SNP = 'none';
options.MarkerFaceColor.HB = 'none';
options.MarkerFaceColor.uk1 = 'none';
options.MarkerFaceColor.uk2 = 'none';
options.MarkerFaceColor.uk3 = 'none';
options.MarkerFaceColor.FP = 'none';
options.nSubSample=[1,1,1,1,1,1,1];
%change any defaults with given inputs:
% A finite state machine to parse name-value pairs.
i=1;
if rem(nargin-i+1,2) ~= 0
error(message('plotxppautset2:ArgNameValueMismatch'));
end
expectval = 0; % start expecting a name, not a value
while i <= nargin
arg = varargin{i};
if ~expectval
if ~ischar(arg)
error(message('plotxppautset2:NoPropName', i));
end
lowArg = lower(arg);
j = strmatch(lowArg,names);
if isempty(j) % if no matches
error(message('plotxppautset2:InvalidPropName', arg));
elseif length(j) > 1 % if more than one match
% Check for any exact matches (in case any names are subsets of others)
k = strmatch(lowArg,names,'exact');
if length(k) == 1
j = k;
else
matches = deblank(Names(j(1),:));
for k = j(2:length(j))'
matches = [matches ', ' deblank(Names(k,:))]; %#ok<AGROW>
end
error(message('plotxppautset2:AmbiguousPropName',arg,matches));
end
end
expectval = 1; % we expect a value next
else
if strcmpi(lowArg,'nSubSample')
options.nSubSample=arg;
else
options.(deblank(Names(j,:))).SN = arg{1};
options.(deblank(Names(j,:))).SNP = arg{2};
options.(deblank(Names(j,:))).HB = arg{3};
options.(deblank(Names(j,:))).uk1 = arg{4};
options.(deblank(Names(j,:))).uk2 = arg{5};
options.(deblank(Names(j,:))).uk3 = arg{6};
options.(deblank(Names(j,:))).FP = arg{7};
end
expectval = 0;
end
i = i + 1;
end
if expectval
error(message('plotxppautset2:NoValueForProp', arg));
end