3 %>@brief Plots a curve in pieces
if there is a discontinuity in the x-axis
5 %> Mimics the plot() function, but does several plots if x does not have the same increment step.
7 %> If the 'color' option is not passed in varargin, will rotate the colors
8 %> in the COLORS global
10 %> @param x vector of dimension [1]x[nf]
11 %> @param y Vector or matrix of dimension [nf]x[no]. The dimensions here
12 %> are inverted to keep consistent with the plot() function
13 %> @param varargin Will be by-passed to MATLAB's <code>plot()</code>
14 %> @return handles a cell of handles
20 x = x(:); % Makes a column vector
23 y = y(:); % Makes a column vector
24 ny = 1; % number of data rows
29 flag_rotate_color = 1;
30 for i = 1:numel(varargin)
31 if ischar(varargin{i})
32 if strcmp(upper(varargin{i}),
'COLOR')
33 flag_rotate_color = 0;
40 % modedelta = abs(mode(diff(x)));
41 % tol = 1.1*abs(modedelta); % distance difference tolerance
43 no_points = length(x);
49 flag_break = i > no_points;
60 dist = abs(x(i)-x(i-1));
61 tol = abs(x(i-1)-x(i-2));
72 no_plots = no_plots+1;
80 h{no_plots} = plot(x(piece_start:i-1), ynow(piece_start:i-1), args{:});
83 % h{no_plots} = plot(x(piece_start:i-1)*[1, 1]+[-modedelta, modedelta]*.3, ynow(piece_start:i-1)*[1, 1], varargin{:});
84 h{no_plots} = plot(x(piece_start), ynow(piece_start), varargin{:});
function find_color(in i)
function plot_curve_pieces(in x, in y, in varargin)