1 |
function [line_handle] = pp(varargin) |
---|
2 |
|
---|
3 |
%PP Plots and manipulates polar plots |
---|
4 |
% |
---|
5 |
% PP(THETA,R) plots the polar representation of THEATA and R with the |
---|
6 |
% centre and max values being the minimum and maximum values of R. |
---|
7 |
% |
---|
8 |
% PP(THETA,R,S) plots as above, where S is a character string made from |
---|
9 |
% standard plotting formatting in the PLOT function. See HELP PLOT. |
---|
10 |
% |
---|
11 |
% PP(THETA,R,A) plots as above, but within the axis limits of A. A is |
---|
12 |
% a 1x2 or 2x1 array containing the centre value and maximum value of |
---|
13 |
% the polar plot ring axes. |
---|
14 |
% |
---|
15 |
% PP(THETA,R,'Property 1',...) plots as above with the selected |
---|
16 |
% properties. See below for propterties. |
---|
17 |
% |
---|
18 |
% PP('Property 1',...) edits the current figure (if it is a polar plot |
---|
19 |
% figure) to the assigned properties. |
---|
20 |
% |
---|
21 |
% PP('Trace', 3, 'Property 1', ... , 'Trace', 1, 'Property 10', ... ) |
---|
22 |
% changes properties of trace 3 and trace one. Any properties defined |
---|
23 |
% after the trace belong to that trace until a new trace number is |
---|
24 |
% defined. |
---|
25 |
% |
---|
26 |
% PROPERTIES: DEFAULT POSSIBLE |
---|
27 |
% --------------- ----------- ---------- |
---|
28 |
% |
---|
29 |
% GENERAL PLOTTING: |
---|
30 |
% 'ThetaDirection' 'ccw' 'cw','ccw' |
---|
31 |
% 'LineStyle' '-' see PLOT |
---|
32 |
% 'LineWidth' 1 1,2,... |
---|
33 |
% 'LineColor' 'b' see PLOT or RGB vector |
---|
34 |
% 'Marker' 'none' see PLOT |
---|
35 |
% 'ThetaStartAngle' 0 0-360 |
---|
36 |
% 'ppStyle' 0 0,1,2 |
---|
37 |
% |
---|
38 |
% AXES RANGE: |
---|
39 |
% 'MaxValue' 'max' numeric value (greater than CetreValue) |
---|
40 |
% 'CentreValue' 'min' numeric value (less than MaxValue) |
---|
41 |
% |
---|
42 |
% ANGLE AXIS: |
---|
43 |
% 'AngleAxis' 'on' 'on','off','none' |
---|
44 |
% 'AngleStep' 30 numeric value |
---|
45 |
% 'AngleAxisStyle' ':' see PLOT |
---|
46 |
% 'AngleAxisColor' black see PLOT or RGB vector |
---|
47 |
% 'AngleLineWidth' 1 1,2,... |
---|
48 |
% 'AngleLabel' 'on' 'on','off','none' |
---|
49 |
% 'AngleLabelStep' same as axis numeric value |
---|
50 |
% 'AngleFontSize' 10 numeric value |
---|
51 |
% 'AngleFontColor' black see PLOT or RGB vector |
---|
52 |
% 'AngleFontWeight' 'normal' 'normal','bold','light','demi' |
---|
53 |
% 'AngleDegreeMark' 'off' 'off',0, 'on',1 |
---|
54 |
% |
---|
55 |
% RING AXIS: |
---|
56 |
% 'NumRings' 4 integer value >= 0 |
---|
57 |
% 'RingAxis' 'on' 'on','off','none' |
---|
58 |
% 'RingAxisStyle' ':' see PLOT |
---|
59 |
% 'RingAxisColor' black see PLOT or RGB vector |
---|
60 |
% 'RingStep' cal. from No. rings integer value > 0 |
---|
61 |
% 'RingLineWidth' 0.1 1,2,... |
---|
62 |
% 'RingLabel' 'on' 'on','off','none' |
---|
63 |
% 'RingFontSize' 10 numeric value |
---|
64 |
% 'RingFontWeight' 'normal' 'normal','bold','light','demi' |
---|
65 |
% 'RingFontColor' black see PLOT or RGB vector |
---|
66 |
% 'AxisOuterRingStyle' '-' see PLOT |
---|
67 |
% 'RingUnits' '' Some String Value |
---|
68 |
% 'MagMarkAngle' 45 0-360 |
---|
69 |
% |
---|
70 |
% FIGURE PROPERTIES: |
---|
71 |
% 'FigurePosition' |
---|
72 |
% 'FigureBackgroundColor' |
---|
73 |
% 'PlotBackgroundColor' |
---|
74 |
% 'PlotBorderColor' |
---|
75 |
% 'PlotBorderLineColor' |
---|
76 |
% |
---|
77 |
% TRACE: |
---|
78 |
% 'Trace' 1 any trace number |
---|
79 |
% 'LineStyle' '-' see PLOT |
---|
80 |
% 'LineWidth' 1 1,2,... |
---|
81 |
% 'LineColor' 'b' see PLOT or RGB vector |
---|
82 |
% 'Marker' 'none' see PLOT |
---|
83 |
% 'RhoData' |
---|
84 |
% 'ThetaData' |
---|
85 |
% |
---|
86 |
% OTHER: |
---|
87 |
% 'SetupVariables' |
---|
88 |
% 'Axes' |
---|
89 |
% |
---|
90 |
|
---|
91 |
% Author: Robert Schlub |
---|
92 |
% Last Modified: 4th December 2002 |
---|
93 |
|
---|
94 |
|
---|
95 |
%Setup global variables that will be used within function blocks |
---|
96 |
global DB args oc NewTrace Traces CreateNewFigure r theta tc axis_limits HoldWasOn ErrorFlag ppStyle; |
---|
97 |
|
---|
98 |
%default settings |
---|
99 |
tc = struct( 'line_color', [0 0 1] ,... RGB or PLOT value of line color |
---|
100 |
'line_style', '-' ,... line style string same as PLOT function |
---|
101 |
'line_width', 1 ,... line width of trace |
---|
102 |
'line_marker', 'none' ,... line marker style |
---|
103 |
'trace_index', 1 ,... trace number identifier |
---|
104 |
'trace_string', '' );% trace string identifier |
---|
105 |
|
---|
106 |
|
---|
107 |
oc = struct( 'theta_start', 0 ,... theta start angle in degrees |
---|
108 |
'angle_step', 30 ,... number of theta markers |
---|
109 |
'angle_label_step', 0 ,... number of theta labels |
---|
110 |
'number_of_rings', 4 ,... number of magnitude rings |
---|
111 |
'max_mag', 'max' ,... maximum ring magnitude ('max' makes data's max value it) |
---|
112 |
'centre_value', 'min' ,... minimum ring value (centre value) |
---|
113 |
'background_color', [0.8 0.8 0.8] ,... background color |
---|
114 |
'theta_direction', 'ccw' ,... direction of theta increment |
---|
115 |
'ring_step', 0 ,... step size of rings |
---|
116 |
'mag_mark_angle', 45 ,... angle of magnitude labels |
---|
117 |
'axes_hold', 'off' ,... flag to tell whether axis hold is on or off |
---|
118 |
'ring_color', 'k' ,... ring axis color |
---|
119 |
'ring_style', ':' ,... ring axis style |
---|
120 |
'ring_line_width', 0.1 ,... ring axis line width |
---|
121 |
'ring_border_line_width',0.5 ,... ring border line width |
---|
122 |
'angle_axis', '' ,... angle axis is ON or OFF |
---|
123 |
'angle_color', 'k' ,... angle axis color |
---|
124 |
'angle_style', ':' ,... angle axis style |
---|
125 |
'angle_label', '' ,... angle axis labels are ON or OFF |
---|
126 |
'angle_line_width', 0.1 ,... angle axis line width |
---|
127 |
'angle_font_size', 10 ,... angle axis font size |
---|
128 |
'angle_font_color', 'k' ,... angle axis font color |
---|
129 |
'angle_font_weight', 'normal' ,... angle axis font weight |
---|
130 |
'angle_degree_mark', 'off' ,... degree symbol placed with angle text |
---|
131 |
'ring_axis', '' ,... ring axis is ON or OFF |
---|
132 |
'ring_label', '' ,... ring axis labels are ON or OFF |
---|
133 |
'ring_font_size', 10 ,... ring axis font size |
---|
134 |
'ring_font_color', 'k' ,... ring axis font color |
---|
135 |
'ring_font_weight', 'normal' ,... ring axis font weight |
---|
136 |
'figure_position', [300 150 583 500] ,... figure position and size |
---|
137 |
'outer_ring_style', '-' ,... ring axis border style |
---|
138 |
'ring_units', '' ,... ring axis units string |
---|
139 |
'plot_area_color', [1 1 1] ,... color inside ring axes (the plot area) |
---|
140 |
'circ_border_color', '' ,... color of circular border |
---|
141 |
'circ_border_line_color', '' );% color of line defining circular border |
---|
142 |
|
---|
143 |
|
---|
144 |
|
---|
145 |
%First Argument defines what is expected as the user input to say which option is wanted |
---|
146 |
%First Flag is: 1 if there is data expected after the argurment |
---|
147 |
% 0 if no data expected but contents of third column gets copied into 4th column variable |
---|
148 |
%Second Flag is : s if string data only is expected |
---|
149 |
% v if numerical data only is expected (values) |
---|
150 |
% vs if numerical or string data can be accepted |
---|
151 |
% st if structure data expected |
---|
152 |
%Final string variable points to which variable which the corresponding data is to be assigned to |
---|
153 |
|
---|
154 |
% Argument flag flag variable to alter |
---|
155 |
args = {'SetupVariables' 1 'st' 'oc' %initial setup variables |
---|
156 |
'ThetaDirection' 1 's' 'oc.theta_direction' %theta direction (CW/CCW) |
---|
157 |
'CentreValue' 1 'vs' 'oc.centre_value' %centre value of graph |
---|
158 |
'MaxValue' 1 'vs' 'oc.max_mag' %max value of graph |
---|
159 |
'LineStyle' 1 's' 'Traces{TraceIndex*2}.line_style' %trace style |
---|
160 |
'LineWidth' 1 'v' 'Traces{TraceIndex*2}.line_width' %trace width |
---|
161 |
'LineColor' 1 'vs' 'Traces{TraceIndex*2}.line_color' %trace color |
---|
162 |
'Marker' 1 's' 'Traces{TraceIndex*2}.line_marker' %trace marker style |
---|
163 |
'ThetaStartAngle' 1 'v' 'oc.theta_start' %theta start angle (refer note below) |
---|
164 |
'AngleAxis' 1 's' 'oc.angle_axis' %angle axis is ON or OFF |
---|
165 |
'AngleStep' 1 'v' 'oc.angle_step' %angle axis step size (between axes) |
---|
166 |
'AngleAxisStyle' 1 's' 'oc.angle_style' %angle axis style |
---|
167 |
'AngleAxisColor' 1 'vs' 'oc.angle_color' %angle axis color |
---|
168 |
'AngleLineWidth' 1 'vs' 'oc.angle_line_width' %angle axis line width |
---|
169 |
'AngleLabel' 1 's' 'oc.angle_label' %angle axis label is ON or OFF |
---|
170 |
'AngleLabelStep' 1 'v' 'oc.angle_label_step' %angle axis label step size |
---|
171 |
'AngleFontSize' 1 'v' 'oc.angle_font_size' %angle axis label font size |
---|
172 |
'AngleFontColor' 1 'vs' 'oc.angle_font_color' %angle axis font color |
---|
173 |
'AngleFontWeight' 1 's' 'oc.angle_font_weight' %angle axis label font weight |
---|
174 |
'AngleDegreeMark', 1 'vs' 'oc.angle_degree_mark' %marks the degrees character with angle text |
---|
175 |
'NumRings' 1 'v' 'oc.number_of_rings' %ring axes number |
---|
176 |
'RingAxis' 1 's' 'oc.ring_axis' %ring axis is on or off |
---|
177 |
'RingAxisStyle' 1 's' 'oc.ring_style' %ring axis style |
---|
178 |
'RingAxisColor' 1 'vs' 'oc.ring_color' %ring axis color |
---|
179 |
'RingStep' 1 'v' 'oc.ring_step' %ring axis step size |
---|
180 |
'RingBorderLineWidth' 1 'v' 'oc_ring_border_line_width' %ring border line width |
---|
181 |
'RingLineWidth' 1 'vs' 'oc.ring_line_width' %ring axis line width |
---|
182 |
'RingLabel' 1 's' 'oc.ring_label' %ring axis labeling is ON or OFF |
---|
183 |
'RingFontSize' 1 'v' 'oc.ring_font_size' %ring axis label font size |
---|
184 |
'RingFontWeight' 1 's' 'oc.ring_font_weight' %ring axis label font size |
---|
185 |
'RingFontColor' 1 'vs' 'oc.ring_font_color' %ring axis font color |
---|
186 |
'AxisOuterRingStyle' 1 's' 'oc.outer_ring_style' %ring axis border (circumference) style |
---|
187 |
'RingUnits' 1 's' 'oc.ring_units' %ring axis label units |
---|
188 |
'MagMarkAngle' 1 'v' 'oc.mag_mark_angle' %ring axis label angle |
---|
189 |
'FigurePosition' 1 'vs' 'oc.figure_position' %position and size of figure on screen |
---|
190 |
'FigureBackgroundColor' 1 'vs' 'oc.background_color' %figure background color (outside plot area) |
---|
191 |
'PlotBackgroundColor' 1 'vs' 'oc.plot_area_color' %plot area background color |
---|
192 |
'PlotBorderLineColor' 1 'vs' 'oc.circ_border_line_color' %circular border line color |
---|
193 |
'PlotBorderColor' 1 'vs' 'oc.circ_border_color' %circular border color |
---|
194 |
'Axis' 1 'vs' 'axis_limits' %limits of axis |
---|
195 |
'Axes' 1 'vs' 'axis_limits' %limits of axes (as in plural spelling but same result) |
---|
196 |
'Trace' 1 'v' 'TraceIndex' %current trace number - used to edit plot parameters of the trace |
---|
197 |
'ThetaData', 1 'v' 'Traces{TraceIndex*2-1}(:,2)' %Theta data |
---|
198 |
'RhoData', 1 'v' 'Traces{TraceIndex*2-1}(:,1)' %Rho Data |
---|
199 |
'ppStyle', 1 'v' 'ppStyle' %A style of axes presentation |
---|
200 |
}; |
---|
201 |
%NOTES: |
---|
202 |
%ThetaStartAngle is relative to the direction of theta. ie, a start angle of 90 will be 180 differnt between |
---|
203 |
%clock wise and counter clock wise direction of theta. |
---|
204 |
|
---|
205 |
%Setup a space for Traces |
---|
206 |
Traces = ''; |
---|
207 |
|
---|
208 |
%set up the variable axis limits. It is a 1x2 array whose first element contains the centre value and second |
---|
209 |
%element contains the max magnitude. |
---|
210 |
axis_limits = [0 0]; |
---|
211 |
|
---|
212 |
%If ErrorFlag ever goes to 1 then will be quitting out |
---|
213 |
ErrorFlag = 0; |
---|
214 |
|
---|
215 |
%Set default value of ppStyle |
---|
216 |
%Style Types: |
---|
217 |
% 0: No Changes |
---|
218 |
% 1: Default |
---|
219 |
% 2: Grey solid axes with 'dB' as ring units and degree marks present |
---|
220 |
% |
---|
221 |
ppStyle = 0; |
---|
222 |
|
---|
223 |
|
---|
224 |
|
---|
225 |
|
---|
226 |
|
---|
227 |
|
---|
228 |
|
---|
229 |
|
---|
230 |
|
---|
231 |
|
---|
232 |
|
---|
233 |
|
---|
234 |
|
---|
235 |
|
---|
236 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
237 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
238 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
239 |
% % |
---|
240 |
% MAIN % |
---|
241 |
% % |
---|
242 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
243 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
244 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
245 |
|
---|
246 |
%First check all input arguments and ensure they are valid. Also get back a flag to say whether the new data |
---|
247 |
%is being added or not (if not, then simple figure/axes/current_trace properties are being changed |
---|
248 |
CheckInput(varargin); |
---|
249 |
if ErrorFlag, return; end |
---|
250 |
|
---|
251 |
%if NewTrace == 0 or hold is on, then load the user_data from the current figure and fill 'oc' and 'Traces' |
---|
252 |
LoadExistingData; |
---|
253 |
if ErrorFlag, return; end |
---|
254 |
|
---|
255 |
%Assign input arguments to their corresponding variables |
---|
256 |
AssignInput(varargin); %this will overwrite any varibales in oc etc that have been updated |
---|
257 |
if ErrorFlag, return; end |
---|
258 |
|
---|
259 |
AssignStyle(ppStyle); |
---|
260 |
if ErrorFlag, return; end |
---|
261 |
|
---|
262 |
CheckAxisLimits; |
---|
263 |
if ErrorFlag, return; end |
---|
264 |
|
---|
265 |
CheckPlotLimits; |
---|
266 |
if ErrorFlag, return; end |
---|
267 |
|
---|
268 |
SetupFigure; |
---|
269 |
|
---|
270 |
%Save Userdata to figure |
---|
271 |
UserData{1} = 'Bobs Polar Plot'; |
---|
272 |
UserData{2} = oc; |
---|
273 |
UserData = [UserData Traces]; |
---|
274 |
set(gcf,'UserData', UserData); %save updated trace data into figure |
---|
275 |
|
---|
276 |
PlotAxes; |
---|
277 |
|
---|
278 |
for i=1:2:length(Traces) |
---|
279 |
ThetaPlot = SetupTheta( Traces{i}(:,2) ); |
---|
280 |
DB = 0; |
---|
281 |
if(i>1) |
---|
282 |
DB = 1; |
---|
283 |
% keyboard |
---|
284 |
end |
---|
285 |
|
---|
286 |
[RPlot ThetaPlot PlotProperties] = SetupR( Traces{i}(:,1) , ThetaPlot ); |
---|
287 |
PlotTrace(ThetaPlot, RPlot, PlotProperties, Traces{i+1}); |
---|
288 |
end |
---|
289 |
|
---|
290 |
if HoldWasOn == 0 |
---|
291 |
hold off |
---|
292 |
end |
---|
293 |
|
---|
294 |
|
---|
295 |
|
---|
296 |
|
---|
297 |
|
---|
298 |
|
---|
299 |
|
---|
300 |
|
---|
301 |
|
---|
302 |
|
---|
303 |
|
---|
304 |
|
---|
305 |
|
---|
306 |
|
---|
307 |
|
---|
308 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
309 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
310 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
311 |
% % |
---|
312 |
% CHECK INPUT % |
---|
313 |
% % |
---|
314 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
315 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
316 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
317 |
|
---|
318 |
%This function will go through the input string entered into pp(). It will simply ensure |
---|
319 |
%valid ordering of commands and will assign NewTrace a value depending on if Trace Data |
---|
320 |
%is present or not in the input arguments |
---|
321 |
|
---|
322 |
function CheckInput(VariableArgIn) |
---|
323 |
|
---|
324 |
global args NewTrace ErrorFlag; |
---|
325 |
|
---|
326 |
%find the number or inputs and the number of possible arguments |
---|
327 |
num_inputs = length(VariableArgIn); |
---|
328 |
|
---|
329 |
m = 0; |
---|
330 |
NewTrace = 0; %This is set if there is data (in the form of a trace) to be added to the plot |
---|
331 |
|
---|
332 |
%now, step through all the arguments and compare them to valid arguments |
---|
333 |
while m < num_inputs %number of inputs into function (ie number of variables separated by commas) |
---|
334 |
m = m + 1; |
---|
335 |
n = 0; |
---|
336 |
|
---|
337 |
%if the first element is numeric check the second element to ensure it is also numberic and the same length |
---|
338 |
%as theta and r must be the same sizes |
---|
339 |
if m == 1 & isnumeric(VariableArgIn{m}) |
---|
340 |
%check to make sure there is a second input argument |
---|
341 |
if num_inputs < 2 |
---|
342 |
DispError('No Rho values Present'); |
---|
343 |
return |
---|
344 |
end |
---|
345 |
if isnumeric(VariableArgIn{m+1}) & max(length(VariableArgIn{m+1})) == max(length(VariableArgIn{m})) |
---|
346 |
m = 2; %move to after the RHO element which was just analysed |
---|
347 |
%now check to see if the next input is the axes limits (it will be if its a numeric value) |
---|
348 |
%this is the only case the third input can be numeric (without a property identifier) |
---|
349 |
if num_inputs > 2 |
---|
350 |
if isnumeric(VariableArgIn{m+1}) %m = 3 now |
---|
351 |
m = 3; %move to after the AXIS LIMITS variable which was just analysed |
---|
352 |
end |
---|
353 |
end |
---|
354 |
else |
---|
355 |
DispError('THETA and R must be an equal length 1xm or mx1 array or variables'); |
---|
356 |
return |
---|
357 |
end |
---|
358 |
|
---|
359 |
%if we have got here without error then there is a valid new trace being added or created |
---|
360 |
NewTrace = 1; |
---|
361 |
continue; %skip through to start of while loop again |
---|
362 |
end |
---|
363 |
|
---|
364 |
%search for the string in the args array and return the args index |
---|
365 |
index = FindArgsIndex(VariableArgIn{m}); |
---|
366 |
|
---|
367 |
%if an index was found and another agument is expected to complete it, then ensure that |
---|
368 |
%the input after it is valid (string, value of struct) |
---|
369 |
if index > 0 & args{index,2} == 1 %if another argument is expected to complete this one |
---|
370 |
if m + 1 > num_inputs %if there is no more completeing argument |
---|
371 |
DispError(['No input argument for "' VariableArgIn{m} '"']) %exit |
---|
372 |
return |
---|
373 |
end |
---|
374 |
%check 2nd flag of args to see if string or number is expected |
---|
375 |
switch args{index,3} |
---|
376 |
case 'v' %assign variable with number |
---|
377 |
if ischar(VariableArgIn{m+1}) |
---|
378 |
DispError(['The input argument for "' VariableArgIn{m} '" must be numerical']); |
---|
379 |
return |
---|
380 |
end %note the lack of break sends the case through to string check |
---|
381 |
case 's' %assign variable with string |
---|
382 |
if ischar(VariableArgIn{m+1}) == 0 |
---|
383 |
DispError(['The input argument for "' VariableArgIn{m} '" must be a string']); |
---|
384 |
return |
---|
385 |
end |
---|
386 |
case 'vs' |
---|
387 |
if (ischar(VariableArgIn{m+1}) == 0 & isnumeric(VariableArgIn{m+1}) == 0) |
---|
388 |
DispError(['The input argument for "' VariableArgIn{m} '" must be either numerical, or a string (not a cell, struct etc.)']); |
---|
389 |
return |
---|
390 |
end |
---|
391 |
case 'st' %the only structure is the 'SetupVariables' cell |
---|
392 |
if isstruct(VariableArgIn{m+1}) == 0 |
---|
393 |
DispError(['The input argument for "' VariableArgIn{m} '" must be a structure']); |
---|
394 |
return |
---|
395 |
end |
---|
396 |
end |
---|
397 |
m = m+1; %increment the m counter so that input of the argument is not checked as an argument |
---|
398 |
|
---|
399 |
%in the case that the string wasn't found in args, it might be a standard plotting string. This will only |
---|
400 |
%happen if m = 3 and a trace is being added. If thats the case then ensure then ensure the string is valid |
---|
401 |
elseif index == 0 & m == 3 & NewTrace & length(VariableArgIn{m}) <= 4 |
---|
402 |
CheckStandardPlot(VariableArgIn{m}); %this will quit out if there is a syntax error in the string |
---|
403 |
if ErrorFlag, return; end |
---|
404 |
|
---|
405 |
%Otherwise the string is not valid |
---|
406 |
else |
---|
407 |
DispError(['The argument "' VariableArgIn{m} '" is not valid. See help']); |
---|
408 |
return |
---|
409 |
end |
---|
410 |
end |
---|
411 |
|
---|
412 |
|
---|
413 |
|
---|
414 |
|
---|
415 |
|
---|
416 |
|
---|
417 |
|
---|
418 |
|
---|
419 |
|
---|
420 |
|
---|
421 |
|
---|
422 |
|
---|
423 |
|
---|
424 |
|
---|
425 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
426 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
427 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
428 |
% % |
---|
429 |
% LoadExistingData - LOAD EXISTING DATA % |
---|
430 |
% % |
---|
431 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
432 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
433 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
434 |
|
---|
435 |
%If hold is on or existing figure properties are being modified, then load the existing figures user_data |
---|
436 |
function LoadExistingData |
---|
437 |
|
---|
438 |
global Traces oc NewTrace CreateNewFigure HoldWasOn; |
---|
439 |
|
---|
440 |
%Default is to Create a new figure |
---|
441 |
CreateNewFigure = 1; |
---|
442 |
|
---|
443 |
%Default HoldWasOn flag is 0 (ie hold was not on) |
---|
444 |
HoldWasOn = 0; |
---|
445 |
|
---|
446 |
if max(findobj) ~= 0 |
---|
447 |
%if hold is on then set the HoldWasOn flag so it can be turned on after all plotting complete |
---|
448 |
|
---|
449 |
if ishold |
---|
450 |
HoldWasOn = 1; |
---|
451 |
end |
---|
452 |
|
---|
453 |
%if the current figure has hold on or we are editing an existing figure then we need to check to make sure its valid |
---|
454 |
if ishold | NewTrace==0 |
---|
455 |
user_data = get(gcf, 'UserData'); |
---|
456 |
if ~strcmp(user_data{1}, 'Bobs Polar Plot') |
---|
457 |
DispError('Current figure is not a valid polar plot figure - it must be created using the pp function'); |
---|
458 |
return |
---|
459 |
end |
---|
460 |
|
---|
461 |
%If the figure is valid, then load the oc structure from it |
---|
462 |
oc = user_data{2}; |
---|
463 |
|
---|
464 |
%Load the existing Traces |
---|
465 |
if(length(user_data)>2) |
---|
466 |
Traces = cell(1,length(user_data)-2); |
---|
467 |
for i=1:length(user_data)-2 |
---|
468 |
Traces{i} = user_data{i+2}; |
---|
469 |
end |
---|
470 |
end |
---|
471 |
|
---|
472 |
%if hold is on, or just properties are being added then we don't want to be creating a new figure later on |
---|
473 |
CreateNewFigure = 0; |
---|
474 |
end |
---|
475 |
%Otherwise if no figure is present but no new trace data exists then there is an error |
---|
476 |
elseif NewTrace == 0 |
---|
477 |
DispError('No figure to modify properties of'); |
---|
478 |
return |
---|
479 |
end |
---|
480 |
|
---|
481 |
|
---|
482 |
|
---|
483 |
|
---|
484 |
|
---|
485 |
|
---|
486 |
|
---|
487 |
|
---|
488 |
|
---|
489 |
|
---|
490 |
|
---|
491 |
|
---|
492 |
|
---|
493 |
|
---|
494 |
|
---|
495 |
|
---|
496 |
|
---|
497 |
|
---|
498 |
|
---|
499 |
|
---|
500 |
|
---|
501 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
502 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
503 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
504 |
% % |
---|
505 |
% ASIGN INPUT % |
---|
506 |
% % |
---|
507 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
508 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
509 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
510 |
|
---|
511 |
function AssignInput(VariableArgIn) |
---|
512 |
|
---|
513 |
global theta r args axis_limits NewTrace Traces tc oc ppStyle; |
---|
514 |
|
---|
515 |
num_inputs = length(VariableArgIn); |
---|
516 |
|
---|
517 |
%set default trace |
---|
518 |
TraceIndex = 1; |
---|
519 |
|
---|
520 |
m = 0; %needs to be zero for the while loop 35 lines below |
---|
521 |
|
---|
522 |
%First assign theta, r and axis_limits if a new trace is being entered |
---|
523 |
if NewTrace |
---|
524 |
|
---|
525 |
%If a trace is being added append two cells on the end of Traces (one for the r/theta values |
---|
526 |
%and the other for tc) |
---|
527 |
Traces = [Traces cell(1,2)]; |
---|
528 |
|
---|
529 |
%set the trace number an unassigned number |
---|
530 |
TraceIndex = length(Traces)/2; |
---|
531 |
|
---|
532 |
%setup the default trace properties structure; |
---|
533 |
tc.trace_index = TraceIndex; |
---|
534 |
Traces{TraceIndex*2} = tc; |
---|
535 |
|
---|
536 |
m = 1; %Look at the first element of VariableArgIn (which should be the theta data) |
---|
537 |
|
---|
538 |
theta = VariableArgIn{m}; %Get the Theta Data |
---|
539 |
|
---|
540 |
r = VariableArgIn{m+1}; %Get the Rho Data |
---|
541 |
|
---|
542 |
%set theta, rho and original theta to be column vectors if they aren't already |
---|
543 |
[rows cols] = size(theta); |
---|
544 |
if rows == 1 |
---|
545 |
theta = theta'; |
---|
546 |
end |
---|
547 |
[rows cols] = size(r); |
---|
548 |
if rows == 1 |
---|
549 |
r = r'; |
---|
550 |
end |
---|
551 |
|
---|
552 |
%assign the theta and r values to the appropriate trace |
---|
553 |
Traces{TraceIndex*2-1} = [r theta]; |
---|
554 |
|
---|
555 |
m = 2; %move to the RHO element which was just analysed |
---|
556 |
|
---|
557 |
%now check to see if the next input is the axes limits (it will be if its a numeric value) or |
---|
558 |
%the standard plot string (it will be if its a string that can't be found) |
---|
559 |
if num_inputs > 2 |
---|
560 |
%if numeric, then must be axis limits |
---|
561 |
if isnumeric(VariableArgIn{m+1}) %m = 2 now (3 lines up) |
---|
562 |
axis_limits = VariableArgIn{m+1}; |
---|
563 |
m = 3; %move to the axis limits variable which was just analysed |
---|
564 |
|
---|
565 |
%if string and non existant in args, then must be standard plotting values |
---|
566 |
elseif FindArgsIndex(VariableArgIn{m+1}) == 0 |
---|
567 |
[Color, Marker, Style] = CheckStandardPlot(VariableArgIn{m+1}); |
---|
568 |
%Assign the color, marker and style if they were defined |
---|
569 |
|
---|
570 |
if ~isempty(Color) |
---|
571 |
Traces{TraceIndex*2}.line_color = Color; |
---|
572 |
end |
---|
573 |
if ~isempty(Marker) |
---|
574 |
Traces{TraceIndex*2}.line_marker = Marker; |
---|
575 |
end |
---|
576 |
if ~isempty(Style) |
---|
577 |
Traces{TraceIndex*2}.line_style = Style; |
---|
578 |
end |
---|
579 |
m = 3; |
---|
580 |
end |
---|
581 |
end |
---|
582 |
end |
---|
583 |
|
---|
584 |
%now, step through all the remaining string arguments and compare them to valid arguments (in args) |
---|
585 |
while m < num_inputs %number of inputs into function (ie number of variables separated by commas) |
---|
586 |
m = m + 1; |
---|
587 |
|
---|
588 |
%find the index in args of the current input argument - we know the index exists as error checking |
---|
589 |
%has been done previously |
---|
590 |
index = FindArgsIndex(VariableArgIn{m}); |
---|
591 |
|
---|
592 |
%if another argument is expected to complete this one then assign it (error checking has already |
---|
593 |
%been performed) |
---|
594 |
if args{index,2} == 1 |
---|
595 |
eval([args{index,4} '= VariableArgIn{m+1};']) |
---|
596 |
m = m+1; %increment the m counter so that input of the argument is not checked as an argument |
---|
597 |
else %if no other arugument is needed assign third colum of args to variable in 4th column |
---|
598 |
eval([args{index,4} '= args{index,3}']); |
---|
599 |
end |
---|
600 |
end |
---|
601 |
|
---|
602 |
%NOTES: |
---|
603 |
% |
---|
604 |
% TaceIndex: The user must enter the argument "..., 'Trace', 3, ..." for trace parameters |
---|
605 |
% of trace 3 to be altered. In doing so, the while loop above will set TraceIndex |
---|
606 |
% to 3. Afterwards, when line style/color etc are altered the evaluation |
---|
607 |
% 'Traces{TraceIndex*2}.line_style' (see args) will be used so trace 3 will have |
---|
608 |
% its properties successfully altered. |
---|
609 |
|
---|
610 |
|
---|
611 |
|
---|
612 |
|
---|
613 |
|
---|
614 |
|
---|
615 |
|
---|
616 |
|
---|
617 |
|
---|
618 |
|
---|
619 |
|
---|
620 |
|
---|
621 |
|
---|
622 |
|
---|
623 |
|
---|
624 |
|
---|
625 |
|
---|
626 |
|
---|
627 |
|
---|
628 |
|
---|
629 |
|
---|
630 |
|
---|
631 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
632 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
633 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
634 |
% % |
---|
635 |
% FIND ARGS INDEX % |
---|
636 |
% % |
---|
637 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
638 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
639 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
640 |
|
---|
641 |
function [index] = FindArgsIndex(StringToFind) |
---|
642 |
global args; |
---|
643 |
index = 1; %start at the first row |
---|
644 |
|
---|
645 |
%search through the args struct till find index varibale in StringToFind |
---|
646 |
while ~strcmp(args{index,1},StringToFind) |
---|
647 |
index = index + 1; |
---|
648 |
|
---|
649 |
%if searched through entire args rows and couldn't find a match then break and return 0 |
---|
650 |
if index > length(args(:,1)) |
---|
651 |
index = 0; |
---|
652 |
break; |
---|
653 |
end |
---|
654 |
end |
---|
655 |
|
---|
656 |
|
---|
657 |
|
---|
658 |
|
---|
659 |
|
---|
660 |
|
---|
661 |
|
---|
662 |
|
---|
663 |
|
---|
664 |
|
---|
665 |
|
---|
666 |
|
---|
667 |
|
---|
668 |
|
---|
669 |
|
---|
670 |
|
---|
671 |
|
---|
672 |
|
---|
673 |
|
---|
674 |
|
---|
675 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
676 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
677 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
678 |
% % |
---|
679 |
% CHECK AXIS LIMITS % |
---|
680 |
% % |
---|
681 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
682 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
683 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
684 |
|
---|
685 |
function CheckAxisLimits |
---|
686 |
global oc axis_limits args |
---|
687 |
|
---|
688 |
%check to see if the axis_limits array elments are empty. If they are not, then it means they have been |
---|
689 |
%filled by the user in the arguments of the function call. Therefore, change the appropriate centre value |
---|
690 |
%and/or maximum magnitude. Because this happens after the assigning of arguments and their variables (above), |
---|
691 |
%then if the 'CentreValue' or 'MaxMag' arguments were used, then they will be overwritten by the axis_limits |
---|
692 |
if isnumeric(axis_limits) & (size(axis_limits) == [1 2] | size(axis_limits) == [2 1]) |
---|
693 |
%if both are zero then user hasn't changed axis (or if they have entered [0 0], then its invalid |
---|
694 |
%because you can't have centre value and max mag equal and therefore this pretends that they haven't |
---|
695 |
%been this stupid on purpose) |
---|
696 |
if axis_limits(1) ~= 0 | axis_limits(2) ~= 0 |
---|
697 |
%but sometimes, you just have to protect the users from themselves |
---|
698 |
if axis_limits(1) == axis_limits(2) |
---|
699 |
disp(' ');disp('Cannot make centre value and maximum mag value the same');disp(' '); |
---|
700 |
else |
---|
701 |
%if valid then assign the centre and max variables to their vew values |
---|
702 |
oc.centre_value = axis_limits(1); %set the center value to the first element |
---|
703 |
oc.max_mag = axis_limits(2); %set the max value to the second element |
---|
704 |
end |
---|
705 |
end |
---|
706 |
elseif ischar(axis_limits) & (strcmpi(axis_limits,'off') | strcmpi(axis_limits,'none')) |
---|
707 |
oc.ring_axis = 'off'; |
---|
708 |
oc.angle_axis = 'off'; |
---|
709 |
elseif ischar(axis_limits) & strcmpi(axis_limits,'on') |
---|
710 |
oc.ring_axis = 'on'; |
---|
711 |
oc.angle_axis = 'on'; |
---|
712 |
else |
---|
713 |
DispError('"Axis" must be followed by 1x2 or 2x1 numerical vector, or by "on", "off" or "none" strings'); |
---|
714 |
return |
---|
715 |
end |
---|
716 |
|
---|
717 |
|
---|
718 |
|
---|
719 |
|
---|
720 |
|
---|
721 |
|
---|
722 |
|
---|
723 |
|
---|
724 |
|
---|
725 |
|
---|
726 |
|
---|
727 |
|
---|
728 |
|
---|
729 |
|
---|
730 |
|
---|
731 |
|
---|
732 |
|
---|
733 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
734 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
735 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
736 |
% % |
---|
737 |
% SETUP FIGURE % |
---|
738 |
% % |
---|
739 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
740 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
741 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
742 |
function SetupFigure |
---|
743 |
|
---|
744 |
global CreateNewFigure oc |
---|
745 |
|
---|
746 |
%If creating a new figure (flag set in LoadExistingData) then create one |
---|
747 |
%if CreateNewFigure |
---|
748 |
% figure; |
---|
749 |
%else |
---|
750 |
clf reset; %Otherwise if hold is on, or property modification only, then reset |
---|
751 |
%end %the current figure for full redraw |
---|
752 |
|
---|
753 |
%Set the figure properties |
---|
754 |
set(gcf,'Color',oc.background_color,'Position',oc.figure_position) |
---|
755 |
|
---|
756 |
%Turn hold on for drawing of axes and traces |
---|
757 |
hold on |
---|
758 |
|
---|
759 |
|
---|
760 |
|
---|
761 |
|
---|
762 |
|
---|
763 |
|
---|
764 |
|
---|
765 |
|
---|
766 |
|
---|
767 |
|
---|
768 |
|
---|
769 |
|
---|
770 |
|
---|
771 |
|
---|
772 |
|
---|
773 |
|
---|
774 |
|
---|
775 |
|
---|
776 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
777 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
778 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
779 |
% % |
---|
780 |
% PLOT AXES % |
---|
781 |
% % |
---|
782 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
783 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
784 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
785 |
|
---|
786 |
function PlotAxes |
---|
787 |
|
---|
788 |
global oc r |
---|
789 |
|
---|
790 |
%check to see if the degrees character is supposed to be plotted or not |
---|
791 |
degrees_string = ''; |
---|
792 |
if(min(oc.angle_degree_mark == 1) == 1 | strcmp(oc.angle_degree_mark, 'on')) |
---|
793 |
degrees_string = '^{\o}'; |
---|
794 |
end |
---|
795 |
|
---|
796 |
%angle system for all corresponding axis |
---|
797 |
phi = 0:0.01:2*pi; |
---|
798 |
|
---|
799 |
%make a circle for the plot's circular border |
---|
800 |
if ~isempty(oc.circ_border_line_color) | ~isempty(oc.circ_border_color) |
---|
801 |
border_line = 1.3; |
---|
802 |
x = border_line*cos(phi); |
---|
803 |
y = border_line*sin(phi); |
---|
804 |
if ~isempty(oc.circ_border_color) |
---|
805 |
fill(x,y,oc.circ_border_color,'LineStyle','none','HandleVisibility','off'); |
---|
806 |
end |
---|
807 |
if ~isempty(oc.circ_border_line_color) |
---|
808 |
plot(x,y,'Color',oc.circ_border_line_color,'LineWidth',2,'HandleVisibility','off'); |
---|
809 |
end |
---|
810 |
axis([-1.55 1.55 -1.55 1.55]) |
---|
811 |
else |
---|
812 |
axis([-1.2 1.2 -1.2 1.2]) |
---|
813 |
end |
---|
814 |
|
---|
815 |
%Make up maximum magnitudes and minimum magnitudes |
---|
816 |
if strcmp(oc.max_mag,'max') |
---|
817 |
oc.max_mag = max(r); |
---|
818 |
end |
---|
819 |
|
---|
820 |
if strcmp(oc.centre_value, 'min') |
---|
821 |
oc.centre_value = min(r); |
---|
822 |
end |
---|
823 |
plot_range = oc.max_mag - oc.centre_value; |
---|
824 |
|
---|
825 |
%Draw the concentric circles (rings) |
---|
826 |
rings = 1; %outer ring |
---|
827 |
if oc.ring_step == 0 %if number of rings defined (default) and not ring step then... |
---|
828 |
for i = 1:1:oc.number_of_rings |
---|
829 |
rings = [rings (oc.number_of_rings-i)/oc.number_of_rings]; |
---|
830 |
end |
---|
831 |
else |
---|
832 |
if oc.ring_step > plot_range |
---|
833 |
disp('Warning: Ring step is larger than plotting range (max_mag - centre_value)'); |
---|
834 |
end |
---|
835 |
for i = 1-oc.ring_step/plot_range:-oc.ring_step/plot_range:0 %If user define ring step then... |
---|
836 |
rings = [rings i]; |
---|
837 |
end |
---|
838 |
|
---|
839 |
end |
---|
840 |
|
---|
841 |
%draw the plot fill circle only if one of the axes are on |
---|
842 |
if (~strcmpi(oc.ring_axis,'off') & ~strcmpi(oc.ring_axis,'none')) |... |
---|
843 |
(~strcmpi(oc.angle_axis, 'none') & ~strcmpi(oc.angle_axis, 'off')) |
---|
844 |
fill(cos(phi),sin(phi),oc.plot_area_color,'HandleVisibility','off') |
---|
845 |
end |
---|
846 |
|
---|
847 |
%only draw the ring axis and its labels if axis is not set of 'OFF' |
---|
848 |
if ~strcmpi(oc.ring_axis, 'off') & ~strcmpi(oc.ring_axis, 'none') |
---|
849 |
for i = 1:1:length(rings) %plot the rings |
---|
850 |
x = rings(i)*cos(phi); |
---|
851 |
y = rings(i)*sin(phi); |
---|
852 |
if(rings(i) == 1) %if on the outer ring, then make a solid line unless user specifies otherwise |
---|
853 |
plot(x,y,'Color',oc.ring_color,'LineStyle',oc.outer_ring_style,'LineWidth',oc.ring_border_line_width,... |
---|
854 |
'HandleVisibility','off'); |
---|
855 |
else |
---|
856 |
plot(x,y,'Color',oc.ring_color,'LineStyle',oc.ring_style,'LineWidth',oc.ring_line_width,... |
---|
857 |
'HandleVisibility','off'); |
---|
858 |
end |
---|
859 |
end |
---|
860 |
|
---|
861 |
%Draw on the text labeling the magnitude |
---|
862 |
angle_of_mark = oc.mag_mark_angle*pi/180; |
---|
863 |
if ~strcmpi(oc.ring_label,'off') & ~strcmpi(oc.ring_label,'none') %the strcmpi is case insensitive |
---|
864 |
for i = 1:1:length(rings) |
---|
865 |
x = (rings(i)+0.0*oc.max_mag)*cos(angle_of_mark); |
---|
866 |
y = (rings(i)+0.0*oc.max_mag)*sin(angle_of_mark); |
---|
867 |
if(rings(i) == 1) %if on the outer ring's value, then insert units if user has defined them |
---|
868 |
text(x,y,[num2str(round(rings(i)*plot_range*1000)/1000+round(oc.centre_value*1000)/1000) oc.ring_units],... |
---|
869 |
'FontSize',oc.ring_font_size, 'FontWeight',oc.ring_font_weight,... |
---|
870 |
'HorizontalAlignment','left', 'VerticalAlignment','bottom','Color',oc.ring_font_color,... |
---|
871 |
'HandleVisibility','off') |
---|
872 |
else |
---|
873 |
text(x,y,num2str(round(rings(i)*plot_range*1000)/1000+round(oc.centre_value*1000)/1000),... |
---|
874 |
'FontSize',oc.ring_font_size, 'FontWeight',oc.ring_font_weight,... |
---|
875 |
'HorizontalAlignment','left','VerticalAlignment','bottom','Color',oc.ring_font_color,... |
---|
876 |
'HandleVisibility','off') |
---|
877 |
end |
---|
878 |
end |
---|
879 |
end |
---|
880 |
end |
---|
881 |
|
---|
882 |
%Draw the angle markers |
---|
883 |
if strcmp(oc.angle_step,'') %if angle step not defined |
---|
884 |
phi = (oc.theta_start:360/no_angle_marks:oc.theta_start+359)*pi/180; %angle of marks |
---|
885 |
phit = oc.theta_start:360/no_angle_marks:oc.theta_start+359; %angle of labels |
---|
886 |
else %if angle step defined |
---|
887 |
phi = (oc.theta_start:oc.angle_step:oc.theta_start+359)*pi/180; |
---|
888 |
phit = oc.theta_start:oc.angle_step:oc.theta_start+359; |
---|
889 |
end |
---|
890 |
|
---|
891 |
%only draw the angle axis and its labels if axis is not set of 'OFF' |
---|
892 |
if ~strcmpi(oc.angle_axis, 'off') & ~strcmpi(oc.angle_axis, 'none') |
---|
893 |
for i = 1:1:length(phi) |
---|
894 |
x = 1*cos(phi(i)); |
---|
895 |
y = 1*sin(phi(i)); |
---|
896 |
plot([0 x],[0 y],'Color',oc.angle_color,'LineStyle',oc.angle_style,'LineWidth',oc.angle_line_width,... |
---|
897 |
'HandleVisibility','off') |
---|
898 |
end |
---|
899 |
|
---|
900 |
%if labels should not be put on every anlge mark then change the text anlges accordingly |
---|
901 |
if oc.angle_label_step ~= 0 |
---|
902 |
phit = oc.theta_start:oc.angle_label_step:oc.theta_start+359; |
---|
903 |
end |
---|
904 |
|
---|
905 |
if strcmp(oc.theta_direction,'cw') |
---|
906 |
phit = -phit; |
---|
907 |
end |
---|
908 |
|
---|
909 |
%Draw on text labeling the angles |
---|
910 |
if ~strcmpi(oc.angle_label,'off') & ~strcmpi(oc.angle_label,'none') |
---|
911 |
for i = 1:1:length(phit) |
---|
912 |
x = 1*1.15*cos(phit(i)*pi/180); |
---|
913 |
y = 1*1.15*sin(phit(i)*pi/180); |
---|
914 |
text(x,y,[num2str(abs(phit(i))-oc.theta_start) degrees_string],... |
---|
915 |
'FontSize',oc.angle_font_size,'FontWeight',oc.angle_font_weight,... |
---|
916 |
'HorizontalAlignment','center','VerticalAlignment','middle',... |
---|
917 |
'Color',oc.angle_font_color,'HandleVisibility','off') |
---|
918 |
end |
---|
919 |
end |
---|
920 |
end |
---|
921 |
axis off |
---|
922 |
|
---|
923 |
|
---|
924 |
|
---|
925 |
|
---|
926 |
|
---|
927 |
|
---|
928 |
|
---|
929 |
|
---|
930 |
|
---|
931 |
|
---|
932 |
|
---|
933 |
|
---|
934 |
|
---|
935 |
|
---|
936 |
|
---|
937 |
|
---|
938 |
|
---|
939 |
|
---|
940 |
|
---|
941 |
|
---|
942 |
|
---|
943 |
|
---|
944 |
|
---|
945 |
|
---|
946 |
|
---|
947 |
|
---|
948 |
|
---|
949 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
950 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
951 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
952 |
% % |
---|
953 |
% SETUP THETA % |
---|
954 |
% % |
---|
955 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
956 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
957 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
958 |
%transform the input to plot out correctly in cartesian coordinates |
---|
959 |
function theta = SetupTheta(theta) |
---|
960 |
global oc |
---|
961 |
theta = theta + oc.theta_start/180*pi; |
---|
962 |
if strcmp(oc.theta_direction,'cw') |
---|
963 |
theta = -theta; |
---|
964 |
end |
---|
965 |
|
---|
966 |
|
---|
967 |
|
---|
968 |
|
---|
969 |
|
---|
970 |
|
---|
971 |
|
---|
972 |
|
---|
973 |
|
---|
974 |
|
---|
975 |
|
---|
976 |
|
---|
977 |
|
---|
978 |
|
---|
979 |
|
---|
980 |
|
---|
981 |
|
---|
982 |
|
---|
983 |
|
---|
984 |
|
---|
985 |
|
---|
986 |
|
---|
987 |
|
---|
988 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
989 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
990 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
991 |
% % |
---|
992 |
% SETUP R % |
---|
993 |
% % |
---|
994 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
995 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
996 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
997 |
function [norm_r, theta, PlotProperties] = SetupR(r, theta) |
---|
998 |
global oc DB |
---|
999 |
|
---|
1000 |
%make a note of the original maximum and minimum values of r |
---|
1001 |
max_r = max(r); |
---|
1002 |
min_r = min(r); |
---|
1003 |
|
---|
1004 |
plot_range = oc.max_mag - oc.centre_value; |
---|
1005 |
|
---|
1006 |
%shift r values so minimum is at 0 + centre value difference |
---|
1007 |
norm_r = r - oc.centre_value; |
---|
1008 |
norm_r = norm_r/plot_range; %normalise r values between 0 and 1 where 0 is centre |
---|
1009 |
%value and 1 is max distance from centre (plot_range) |
---|
1010 |
%check all values and any that are negative (and therefore less than the centre value) are made |
---|
1011 |
%equal to the centre value |
---|
1012 |
for i = 1:1:length(norm_r) |
---|
1013 |
if norm_r(i) < 0 |
---|
1014 |
norm_r(i) = 0; |
---|
1015 |
end |
---|
1016 |
end |
---|
1017 |
|
---|
1018 |
%These normalised r values now need to be examined and any values outiside of the |
---|
1019 |
%the maximum magnitude need to be discarded. However, if there is interpolation between |
---|
1020 |
%2 points (one inside the max and one outside) then a new point on this interpolation needs |
---|
1021 |
%to be added in so the line from the point inside the axis still extends out to the outer |
---|
1022 |
%ring. Therefore, a new array of r values which only contain plottable values and additional |
---|
1023 |
%points that are needed is made. |
---|
1024 |
|
---|
1025 |
PlotNumCounter = 0; %Number of plots (ie number of sections within the unity circle) |
---|
1026 |
InPlotFlag = 0; %if 1, this flag means that current points are in a plotting section |
---|
1027 |
PlotStartFlag = ''; %This will be an array containing the start points for the plot sections |
---|
1028 |
PlotBreakFlag = ''; %This will be an array containing the break points for the plot sections |
---|
1029 |
|
---|
1030 |
for i = 1:1:length(norm_r) |
---|
1031 |
%the first point that is on or in the unity circle is allocated as the first section's start point |
---|
1032 |
if isempty(PlotStartFlag) & norm_r(i)<=1 |
---|
1033 |
PlotStartFlag = i; |
---|
1034 |
InPlotFlag = 1; |
---|
1035 |
PlotNumCounter = 1; |
---|
1036 |
else |
---|
1037 |
%If a point is outside the unity circle and not in the void between a break point |
---|
1038 |
%and start point then allocate the break point to the point previous to this one |
---|
1039 |
if(norm_r(i) > 1 & InPlotFlag == 1) |
---|
1040 |
PlotBreakFlag = [PlotBreakFlag i-1]; |
---|
1041 |
InPlotFlag = 0; |
---|
1042 |
end |
---|
1043 |
|
---|
1044 |
%If a point is on or in the unity circle and currently is in the void between a break |
---|
1045 |
%point and start point then allocate this point as the start point of a new section |
---|
1046 |
if(norm_r(i) <= 1 & InPlotFlag == 0) |
---|
1047 |
PlotStartFlag = [PlotStartFlag i]; |
---|
1048 |
InPlotFlag = 1; |
---|
1049 |
PlotNumCounter = PlotNumCounter + 1; |
---|
1050 |
end |
---|
1051 |
end |
---|
1052 |
end |
---|
1053 |
|
---|
1054 |
%finally, if the last point was in a plotting section then have to define it as the break point |
---|
1055 |
if(InPlotFlag == 1) |
---|
1056 |
PlotBreakFlag = [PlotBreakFlag length(norm_r)]; |
---|
1057 |
end |
---|
1058 |
|
---|
1059 |
|
---|
1060 |
%go through each of the start and end points and for each go to the point next to it that is in |
---|
1061 |
%the void (between start and break points) and calculate the gradient and then add in a point between |
---|
1062 |
%the void point and the valid point that lies on this gradient AND the unity circle. This procedure is |
---|
1063 |
%therefore only needed it a plot exists and it exceeds the unity boundary (ie the only break flag doesn't |
---|
1064 |
%index the last point in the set of data) |
---|
1065 |
if(PlotNumCounter > 0) |
---|
1066 |
for i = 1:1:PlotNumCounter |
---|
1067 |
if PlotStartFlag(i) ~= 1 %only look at section starts if its not the first point |
---|
1068 |
x = norm_r.*cos(theta); %need to recalculate x and y every time incase norm_r and |
---|
1069 |
y = norm_r.*sin(theta); %theta were changed in the previous loop |
---|
1070 |
|
---|
1071 |
%if the gradient between the void and valid points is infinity (ie x1=x2) then the line equation |
---|
1072 |
%simple becomes x=b, where b is the x coordinate of both points. We also know that for our wanted |
---|
1073 |
%point to be on the unity circle we need 1=sqrt(x^2+y^2) => 1=x^2+y^2. Therefore, as x=b, we can |
---|
1074 |
%find y as: |
---|
1075 |
% y = 1-x^2 = 1-b^2 |
---|
1076 |
% |
---|
1077 |
%Now, if the void point is in the y>0 quadrants, then the crossing point must occur in the y>0 part |
---|
1078 |
%of the unity circle. Conversely, if the void point has y<0, then the cross point must occur in the |
---|
1079 |
%y<0 semicircle of the unty circle |
---|
1080 |
if x(PlotStartFlag(i))==x(PlotStartFlag(i)-1) |
---|
1081 |
Voidx = x(PlotStartFlag(i)); |
---|
1082 |
Voidy = 1-Voidx^2; |
---|
1083 |
if(y(PlotStartFlag(i)-1)<0) |
---|
1084 |
Voidy = -Voidy; |
---|
1085 |
end |
---|
1086 |
%however, if the gradient is defined, then we need to calc the gradient to find the point on the |
---|
1087 |
%unity circle |
---|
1088 |
else |
---|
1089 |
if x(PlotStartFlag(i)-1)<x(PlotStartFlag(i)) |
---|
1090 |
gradient = (y(PlotStartFlag(i)) - y(PlotStartFlag(i)-1))/(x(PlotStartFlag(i)) - x(PlotStartFlag(i)-1)); |
---|
1091 |
elseif x(PlotStartFlag(i)-1)>x(PlotStartFlag(i)) |
---|
1092 |
% x(PlotStartFlag(i)) |
---|
1093 |
% y(PlotStartFlag(i)) |
---|
1094 |
% keyboard |
---|
1095 |
% r(PlotStartFlag(i)) |
---|
1096 |
gradient = (y(PlotStartFlag(i)-1) - y(PlotStartFlag(i)))/(x(PlotStartFlag(i)-1) - x(PlotStartFlag(i))); |
---|
1097 |
end |
---|
1098 |
%C is y intercept of y=mx+c eqation for a straign line |
---|
1099 |
C = y(PlotStartFlag(i)) - gradient*x(PlotStartFlag(i)); |
---|
1100 |
m = gradient; |
---|
1101 |
|
---|
1102 |
%at the crossing point between line bewteen void and valid and unity circle we know the x,y |
---|
1103 |
%coordinates must satisfy the straight line eqn y=mx+c and 1=sqrt(x^2+y^2) => 1=x^2+y+2. |
---|
1104 |
%Rearranging this yeilds |
---|
1105 |
% 0 = (m^2+1)x^2 + (2mc)x + (c^2-1) |
---|
1106 |
% |
---|
1107 |
%the roots of this can be solved and x found. Note that there will always be one or two |
---|
1108 |
%real roots as this procedure is only being implemented when the line DOES cross the unity |
---|
1109 |
%circle (there will only be one root when the line is a tangent to the unit circle). |
---|
1110 |
Voidx = roots([m^2+1 2*m*C C^2-1]); |
---|
1111 |
Voidy = m*Voidx+C; |
---|
1112 |
%if there are two roots, check which x coordinate is between the void point and valid point |
---|
1113 |
%and then use that as the true coordinate |
---|
1114 |
x_limits = [x(PlotStartFlag(i)-1) x(PlotStartFlag(i))]; |
---|
1115 |
y_limits = [y(PlotStartFlag(i)-1) y(PlotStartFlag(i))]; |
---|
1116 |
if length(Voidx) == 2 |
---|
1117 |
if Voidx(1)>min(x_limits) & Voidx(1)<max(x_limits) & Voidy(1)>min(y_limits) & Voidy(1)<max(y_limits) |
---|
1118 |
Voidx = Voidx(1); |
---|
1119 |
Voidy = Voidy(1); |
---|
1120 |
else |
---|
1121 |
Voidx = Voidx(2); |
---|
1122 |
Voidy = Voidy(2); |
---|
1123 |
end |
---|
1124 |
end |
---|
1125 |
end |
---|
1126 |
|
---|
1127 |
%insert new point into array or points |
---|
1128 |
norm_r = [norm_r(1:PlotStartFlag(i)-1); sqrt(Voidx^2+Voidy^2); norm_r(PlotStartFlag(i):length(norm_r))]; |
---|
1129 |
|
---|
1130 |
%insert new angle into array of angles |
---|
1131 |
if(Voidx == 0) |
---|
1132 |
new_theta = pi/2*sign(Voidy); %this puts the point in the correct quadrant (CA or ST) |
---|
1133 |
else |
---|
1134 |
new_theta = atan(Voidy/Voidx); |
---|
1135 |
%if x is negative then the definition of atan needs to be added to 180 degrees |
---|
1136 |
if(Voidx < 0) |
---|
1137 |
new_theta = pi+new_theta; |
---|
1138 |
end |
---|
1139 |
end |
---|
1140 |
theta = [theta(1:PlotStartFlag(i)-1); new_theta; theta(PlotStartFlag(i):length(theta))]; |
---|
1141 |
|
---|
1142 |
%increment appropiate indecies in PlotStart and PlotBreak flags to take into accout the new points |
---|
1143 |
%(remembering you want the new points to be within the plotting segement) |
---|
1144 |
if(i < PlotNumCounter) %if not at the last PlotStartFlag |
---|
1145 |
PlotStartFlag(i+1:PlotNumCounter) = PlotStartFlag(i+1:PlotNumCounter) + 1; |
---|
1146 |
end |
---|
1147 |
PlotBreakFlag(i:PlotNumCounter) = PlotBreakFlag(i:PlotNumCounter) + 1; |
---|
1148 |
end |
---|
1149 |
|
---|
1150 |
%now do the same thing for the break flags, ie going from valid point to void |
---|
1151 |
%But only consider if the break is NOT the first element, or the break is NOT the last element |
---|
1152 |
if (PlotBreakFlag(i) ~= length(norm_r)) |
---|
1153 |
x = norm_r.*cos(theta); %need to recalc x and y incase norm_r and theta were changed in previous |
---|
1154 |
y = norm_r.*sin(theta); %if statement (for PlotStartFlag) or previous loop |
---|
1155 |
|
---|
1156 |
%refer to previous IF statement (for PlotStartFlag) for full explanation |
---|
1157 |
if x(PlotBreakFlag(i))==x(PlotBreakFlag(i)+1) |
---|
1158 |
Voidx = x(PlotBreakFlag(i)); |
---|
1159 |
Voidy = 1-Voidx^2; |
---|
1160 |
if(y(PlotBreakFlag(i)+1)<0) |
---|
1161 |
Voidy = -Voidy; |
---|
1162 |
end |
---|
1163 |
else |
---|
1164 |
if x(PlotBreakFlag(i)+1)<x(PlotBreakFlag(i)) |
---|
1165 |
gradient = (y(PlotBreakFlag(i)) - y(PlotBreakFlag(i)+1))/(x(PlotBreakFlag(i)) - x(PlotBreakFlag(i)+1)); |
---|
1166 |
elseif x(PlotBreakFlag(i)+1)>x(PlotBreakFlag(i)) |
---|
1167 |
gradient = (y(PlotBreakFlag(i)+1) - y(PlotBreakFlag(i)))/(x(PlotBreakFlag(i)+1) - x(PlotBreakFlag(i))); |
---|
1168 |
end |
---|
1169 |
%C is y intercept of y=mx+c eqation for a straign line |
---|
1170 |
C = y(PlotBreakFlag(i)) - gradient*x(PlotBreakFlag(i)); |
---|
1171 |
m = gradient; |
---|
1172 |
|
---|
1173 |
Voidx = roots([m^2+1 2*m*C C^2-1]); |
---|
1174 |
Voidy = m*Voidx+C; |
---|
1175 |
%if there are two roots, check which x coordinate is between the void point and valid point |
---|
1176 |
%and then use that as the true coordinate |
---|
1177 |
x_limits = [x(PlotBreakFlag(i)+1) x(PlotBreakFlag(i))]; |
---|
1178 |
y_limits = [y(PlotBreakFlag(i)+1) y(PlotBreakFlag(i))]; |
---|
1179 |
if length(Voidx) == 2 |
---|
1180 |
if Voidx(1)>min(x_limits) & Voidx(1)<max(x_limits) & Voidy(1)>min(y_limits) & Voidy(1)<max(y_limits) |
---|
1181 |
Voidx = Voidx(1); |
---|
1182 |
Voidy = Voidy(1); |
---|
1183 |
else |
---|
1184 |
Voidx = Voidx(2); |
---|
1185 |
Voidy = Voidy(2); |
---|
1186 |
end |
---|
1187 |
end |
---|
1188 |
end |
---|
1189 |
%insert new point into array or points |
---|
1190 |
|
---|
1191 |
norm_r = [norm_r(1:PlotBreakFlag(i)); sqrt(Voidx^2+Voidy^2); norm_r(PlotBreakFlag(i)+1:length(norm_r))]; |
---|
1192 |
|
---|
1193 |
%calculate and insert new angle into array of angles |
---|
1194 |
if(Voidx == 0) |
---|
1195 |
new_theta = pi/2*sign(Voidy); |
---|
1196 |
else |
---|
1197 |
new_theta = atan(Voidy/Voidx); |
---|
1198 |
%if x is negative then the definition of atan needs to be added to 180 degrees |
---|
1199 |
if(Voidx < 0) |
---|
1200 |
new_theta = pi+new_theta; |
---|
1201 |
end |
---|
1202 |
end |
---|
1203 |
theta = [theta(1:PlotBreakFlag(i)); new_theta; theta(PlotBreakFlag(i)+1:length(theta))]; |
---|
1204 |
|
---|
1205 |
%increment appropiate indecies in PlotBreak and PlotBreak flags to take into accout the new points |
---|
1206 |
%(remembering you want the new points to be within the plotting segement) |
---|
1207 |
if(i < PlotNumCounter) %if not at the last PlotBreakFlag |
---|
1208 |
PlotStartFlag(i+1:PlotNumCounter) = PlotStartFlag(i+1:PlotNumCounter) + 1; |
---|
1209 |
end |
---|
1210 |
PlotBreakFlag(i:PlotNumCounter) = PlotBreakFlag(i:PlotNumCounter) + 1; |
---|
1211 |
end |
---|
1212 |
end |
---|
1213 |
end |
---|
1214 |
|
---|
1215 |
PlotProperties{1} = PlotNumCounter; |
---|
1216 |
PlotProperties{2} = PlotStartFlag; |
---|
1217 |
PlotProperties{3} = PlotBreakFlag; |
---|
1218 |
|
---|
1219 |
|
---|
1220 |
|
---|
1221 |
|
---|
1222 |
|
---|
1223 |
|
---|
1224 |
|
---|
1225 |
|
---|
1226 |
|
---|
1227 |
|
---|
1228 |
|
---|
1229 |
|
---|
1230 |
|
---|
1231 |
|
---|
1232 |
|
---|
1233 |
|
---|
1234 |
|
---|
1235 |
|
---|
1236 |
|
---|
1237 |
|
---|
1238 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1239 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1240 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1241 |
% % |
---|
1242 |
% PLOT TRACE % |
---|
1243 |
% % |
---|
1244 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1245 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1246 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1247 |
function PlotTrace(theta, norm_r, PlotProperties, TraceProps) |
---|
1248 |
|
---|
1249 |
PlotNumCounter = PlotProperties{1}; |
---|
1250 |
PlotStartFlag = PlotProperties{2}; |
---|
1251 |
PlotBreakFlag = PlotProperties{3}; |
---|
1252 |
|
---|
1253 |
x = norm_r.*cos(theta); |
---|
1254 |
y = norm_r.*sin(theta); |
---|
1255 |
|
---|
1256 |
handle_visibility = 'on'; %first segment trace is to have a handle that can be access by prompt |
---|
1257 |
|
---|
1258 |
%(eg - to use to make the legend) |
---|
1259 |
%if there are any plot sections to plot then go ahead and plot |
---|
1260 |
if(PlotNumCounter > 0) |
---|
1261 |
for i = 1:1:PlotNumCounter %for each plot section redefine x and y between the start and break flags |
---|
1262 |
x = norm_r(PlotStartFlag(i):PlotBreakFlag(i)).*cos(theta(PlotStartFlag(i):PlotBreakFlag(i))); |
---|
1263 |
y = norm_r(PlotStartFlag(i):PlotBreakFlag(i)).*sin(theta(PlotStartFlag(i):PlotBreakFlag(i))); |
---|
1264 |
%plot the thing - FINALLY |
---|
1265 |
|
---|
1266 |
line_handle = plot(x,y,'LineWidth', TraceProps.line_width, 'LineStyle',TraceProps.line_style,'Color',TraceProps.line_color,... |
---|
1267 |
'Marker',TraceProps.line_marker, 'HandleVisibility',handle_visibility); |
---|
1268 |
handle_visibility = 'off'; %once the first trace segment is plotted, want the remaining handles hidden so |
---|
1269 |
end %the legend doesn't display them, but moves straight onto the next trace |
---|
1270 |
end |
---|
1271 |
|
---|
1272 |
|
---|
1273 |
|
---|
1274 |
|
---|
1275 |
|
---|
1276 |
|
---|
1277 |
|
---|
1278 |
|
---|
1279 |
|
---|
1280 |
|
---|
1281 |
|
---|
1282 |
|
---|
1283 |
|
---|
1284 |
|
---|
1285 |
|
---|
1286 |
|
---|
1287 |
|
---|
1288 |
|
---|
1289 |
|
---|
1290 |
|
---|
1291 |
|
---|
1292 |
|
---|
1293 |
|
---|
1294 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1295 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1296 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1297 |
% % |
---|
1298 |
% CHECK PLOT LIMITS % |
---|
1299 |
% % |
---|
1300 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1301 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1302 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1303 |
function CheckPlotLimits |
---|
1304 |
|
---|
1305 |
global oc Traces |
---|
1306 |
|
---|
1307 |
%Make up maximum magnitudes and minimum magnitudes |
---|
1308 |
if ~isnumeric(oc.max_mag) |
---|
1309 |
if strcmp(lower(oc.max_mag),'max') |
---|
1310 |
TraceMax = ''; |
---|
1311 |
for i = 1:2:length(Traces) |
---|
1312 |
TraceMax = [TraceMax max(Traces{i}(:,1))]; |
---|
1313 |
end |
---|
1314 |
oc.max_mag = max(TraceMax); |
---|
1315 |
else |
---|
1316 |
DispError('"MaxValue" must be a value or "max"'); |
---|
1317 |
return |
---|
1318 |
end |
---|
1319 |
end |
---|
1320 |
|
---|
1321 |
if ~isnumeric(oc.centre_value) |
---|
1322 |
if strcmp(lower(oc.centre_value), 'min') |
---|
1323 |
TraceMin = ''; |
---|
1324 |
for i = 1:2:length(Traces) |
---|
1325 |
TraceMin = [TraceMin min(Traces{i}(:,1))]; |
---|
1326 |
end |
---|
1327 |
oc.centre_value = min(TraceMin); |
---|
1328 |
else |
---|
1329 |
DispError('"CentreValue" must be a value or "min"'); |
---|
1330 |
return |
---|
1331 |
end |
---|
1332 |
end |
---|
1333 |
|
---|
1334 |
%make sure input is not bogus |
---|
1335 |
if oc.max_mag < oc.centre_value |
---|
1336 |
DispError('Centre value is larger than maximum input value'); |
---|
1337 |
return |
---|
1338 |
end |
---|
1339 |
|
---|
1340 |
if oc.max_mag == oc.centre_value |
---|
1341 |
DispError('Centre value is same as maximum input value - define CentreValue if all r values are same - see help'); |
---|
1342 |
return |
---|
1343 |
end |
---|
1344 |
|
---|
1345 |
|
---|
1346 |
|
---|
1347 |
|
---|
1348 |
|
---|
1349 |
|
---|
1350 |
|
---|
1351 |
|
---|
1352 |
|
---|
1353 |
|
---|
1354 |
|
---|
1355 |
|
---|
1356 |
|
---|
1357 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1358 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1359 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1360 |
% % |
---|
1361 |
% CHECK STANDARD PLOT % |
---|
1362 |
% % |
---|
1363 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1364 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1365 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1366 |
%This function will check a string that is a shortcut plotting string incorperating the marker, style and color. |
---|
1367 |
%It will return seperate color, marker and style strings if they are found in the combined string. If the |
---|
1368 |
%combined string has a syntax error then the function will exit the m file and return an error referring the |
---|
1369 |
%user to the HELP PLOT help command. |
---|
1370 |
function [Color, Marker, Style] = CheckStandardPlot(PlotString) |
---|
1371 |
|
---|
1372 |
LineColorFlag = 0; |
---|
1373 |
LineMarkerFlag = 0; |
---|
1374 |
LineStyleFlag = 0; |
---|
1375 |
|
---|
1376 |
Color = ''; |
---|
1377 |
Marker = ''; |
---|
1378 |
Style = ''; |
---|
1379 |
|
---|
1380 |
%check the standard_plot variable. If it is not emplty, that means the user has selected the PLOT |
---|
1381 |
%functions shortcut arguments to make a plot. Therefore, convert these arguments to the appropriate |
---|
1382 |
%line color and style. Note, that this will overwrite future uses of LineColor and LineStyle in the |
---|
1383 |
%arguments |
---|
1384 |
|
---|
1385 |
if length(PlotString) > 4 | isempty(PlotString) %color, marker, style |
---|
1386 |
DispError(['Incorrect plot parameters: ''' PlotString '''. Type HELP PLOT to see correct usage']); |
---|
1387 |
return |
---|
1388 |
end |
---|
1389 |
i = 1; |
---|
1390 |
while i <= length(PlotString) |
---|
1391 |
c = PlotString(i); %temp character variable |
---|
1392 |
%check the color |
---|
1393 |
if (c == 'y' | c == 'm' | c == 'c' | c == 'r' | c == 'g' | c == 'b' | c == 'w' | c == 'k') & LineColorFlag == 0 |
---|
1394 |
LineColorFlag = 1; |
---|
1395 |
Color = c; |
---|
1396 |
|
---|
1397 |
%check the marker style |
---|
1398 |
elseif (c == '.' | c == 'o' | c == 'x' | c == '+' | c == '*' | c == 's' | c == 'd' | ... |
---|
1399 |
c == 'v' | c == '^' | c == '<' | c == '>' | c == 'p' | c == 'h') & LineMarkerFlag == 0 |
---|
1400 |
LineMarkerFlag = 1; |
---|
1401 |
Marker = c; |
---|
1402 |
|
---|
1403 |
%check the line style |
---|
1404 |
elseif (c == '-' | c == ':') & LineStyleFlag == 0 %| c == '-.' | c == '--' %THIS NEEDS FIXING |
---|
1405 |
LineStyleFlag = 1; |
---|
1406 |
Style = c; |
---|
1407 |
if(c == '-' & i < length(PlotString) ) |
---|
1408 |
if PlotString(i+1) == '.' | PlotString(i+1) == '-' |
---|
1409 |
Style = [Style PlotString(i+1)]; |
---|
1410 |
i = i + 1; |
---|
1411 |
end |
---|
1412 |
end |
---|
1413 |
%if neither color nor marker nor style then error |
---|
1414 |
else |
---|
1415 |
DispError(['Incorrect plot parameters: ''' PlotString '''. Type HELP PLOT to see correct usage']); |
---|
1416 |
return |
---|
1417 |
end |
---|
1418 |
i = i+1; |
---|
1419 |
end |
---|
1420 |
|
---|
1421 |
|
---|
1422 |
|
---|
1423 |
|
---|
1424 |
|
---|
1425 |
|
---|
1426 |
|
---|
1427 |
|
---|
1428 |
|
---|
1429 |
|
---|
1430 |
|
---|
1431 |
|
---|
1432 |
|
---|
1433 |
|
---|
1434 |
|
---|
1435 |
|
---|
1436 |
|
---|
1437 |
|
---|
1438 |
|
---|
1439 |
|
---|
1440 |
|
---|
1441 |
|
---|
1442 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1443 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1444 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1445 |
% % |
---|
1446 |
% DISP ERROR % |
---|
1447 |
% % |
---|
1448 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1449 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1450 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1451 |
function DispError(ErrorString) |
---|
1452 |
|
---|
1453 |
global ErrorFlag |
---|
1454 |
|
---|
1455 |
ErrorFlag = 1; |
---|
1456 |
disp(sprintf('\nPP ERROR: %s\n Type "help pp" for information\n\n', ErrorString)); |
---|
1457 |
|
---|
1458 |
|
---|
1459 |
|
---|
1460 |
|
---|
1461 |
|
---|
1462 |
|
---|
1463 |
|
---|
1464 |
|
---|
1465 |
|
---|
1466 |
|
---|
1467 |
|
---|
1468 |
|
---|
1469 |
|
---|
1470 |
|
---|
1471 |
|
---|
1472 |
|
---|
1473 |
|
---|
1474 |
|
---|
1475 |
|
---|
1476 |
|
---|
1477 |
|
---|
1478 |
|
---|
1479 |
|
---|
1480 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1481 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1482 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1483 |
% % |
---|
1484 |
% DISP ERROR % |
---|
1485 |
% % |
---|
1486 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1487 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1488 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1489 |
function AssignStyle(ppStyle) |
---|
1490 |
|
---|
1491 |
global oc ErrorFlag |
---|
1492 |
|
---|
1493 |
switch ppStyle |
---|
1494 |
case 0 |
---|
1495 |
return |
---|
1496 |
|
---|
1497 |
%%%%%%%%%% DEFAULT STYLE %%%%%%%%%%% |
---|
1498 |
case 1 |
---|
1499 |
oc.angle_color = [0 0 0]; |
---|
1500 |
oc.ring_color = [0 0 0]; |
---|
1501 |
oc.angle_style = ':'; |
---|
1502 |
oc.ring_style = ':'; |
---|
1503 |
oc.angle_line_width = 0.1; |
---|
1504 |
oc.ring_line_width = 0.1; |
---|
1505 |
oc.ring_units = ''; |
---|
1506 |
oc.angle_degree_mark = 'off'; |
---|
1507 |
|
---|
1508 |
%%%%%%%%% SOLID AXIS in DB Style %%%%%%%% |
---|
1509 |
case 2 |
---|
1510 |
oc.angle_color = [0.5 0.5 0.5]; |
---|
1511 |
oc.ring_color = [0.5 0.5 0.5]; |
---|
1512 |
oc.angle_style = '-'; |
---|
1513 |
oc.ring_style = '-'; |
---|
1514 |
oc.angle_line_width = 0.1; |
---|
1515 |
oc.ring_line_width = 0.1; |
---|
1516 |
oc.ring_units = 'dB'; |
---|
1517 |
oc.angle_degree_mark = 'on'; |
---|
1518 |
|
---|
1519 |
%%%%%%% UNDEFINED STYLE %%%%%%% |
---|
1520 |
otherwise |
---|
1521 |
ErrorFlag = 1; |
---|
1522 |
DispError('ppStyle number not Valid.'); |
---|
1523 |
end |
---|
1524 |
|
---|
1525 |
return |
---|
1526 |
|
---|
1527 |
|
---|
1528 |
|
---|
1529 |
|
---|
1530 |
|
---|
1531 |
|
---|
1532 |
|
---|
1533 |
|
---|
1534 |
|
---|
1535 |
|
---|
1536 |
|
---|
1537 |
|
---|
1538 |
|
---|
1539 |
|
---|
1540 |
|
---|
1541 |
|
---|
1542 |
|
---|
1543 |
|
---|
1544 |
|
---|
1545 |
|
---|
1546 |
|
---|
1547 |
|
---|
1548 |
|
---|
1549 |
|
---|
1550 |
|
---|
1551 |
%## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ## |
---|
1552 |
%# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
---|
1553 |
% # |
---|
1554 |
% Variable Information and Explanation # |
---|
1555 |
% # |
---|
1556 |
%# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
---|
1557 |
%## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ## |
---|
1558 |
|
---|
1559 |
%----------------------------------------------------------------------------------------- |
---|
1560 |
% |
---|
1561 |
% tc: (trace cell) |
---|
1562 |
% Trace properties structure |
---|
1563 |
% |
---|
1564 |
%----------------------------------------------------------------------------------------- |
---|
1565 |
% |
---|
1566 |
% oc: (options cell) |
---|
1567 |
% Plot/Figure/Axes properties structure |
---|
1568 |
% |
---|
1569 |
%----------------------------------------------------------------------------------------- |
---|
1570 |
% |
---|
1571 |
% args: |
---|
1572 |
% Cell matrix containing possible property strings the user can enter and the actions to |
---|
1573 |
% take when the user enters them |
---|
1574 |
% |
---|
1575 |
% eg: A row in args might be: |
---|
1576 |
% |
---|
1577 |
% 'NumRings' 1 'v' oc.number_of_rings |
---|
1578 |
% |
---|
1579 |
% | | | | |
---|
1580 |
% Property Name FLAG indicating Data type variable to store |
---|
1581 |
% data follows expected data to |
---|
1582 |
% property |
---|
1583 |
% |
---|
1584 |
% NB: if FLAG is 0, then whatever is in the third column gets stored in the 4th column variable |
---|
1585 |
% |
---|
1586 |
%----------------------------------------------------------------------------------------- |
---|
1587 |
% |
---|
1588 |
% UserData: |
---|
1589 |
% 1 x n array of cells: (n = Num Traces + 2) |
---|
1590 |
% {1} - "Bob's Polar Plot" string for plot identification |
---|
1591 |
% {2} - oc (figure properties) |
---|
1592 |
% {3} - i x 2 matrix of trace data (columns of Rho and Theta) (i = length(Theta)) |
---|
1593 |
% {4} - tc (trace properties of trace in {3}) |
---|
1594 |
% {5} - k x 2 matrix of trace data (columns of Rho` and Theta`) (k = length(Theta`)) |
---|
1595 |
% {6} - tc` (trace properties or trace in {5}) |
---|
1596 |
% : |
---|
1597 |
% : |
---|
1598 |
% |
---|
1599 |
%----------------------------------------------------------------------------------------- |
---|
1600 |
% |
---|
1601 |
% Traces: |
---|
1602 |
% 1 x n-2 array of cells: |
---|
1603 |
% {1} - same as UserData{3} |
---|
1604 |
% {2} - same as UserData{4} |
---|
1605 |
% {3} - same as UserData{5} |
---|
1606 |
% {4} - same as UserData{6} |
---|
1607 |
% : |
---|
1608 |
% : |
---|
1609 |
% |
---|
1610 |
%----------------------------------------------------------------------------------------- |
---|