Functions | |
function | comet (varargin) if(nargin |
elseif (numel(varargin{1})==1 &&ishandle(varargin{1})&&strcmpi(get(varargin{1},"type"),"axes")) axes(varargin | |
if (numargin==1) y | |
elseif (numargin==2) x = varargin{1} | |
else | print_usage () |
axis (theaxis) | |
drawnow () | |
pause (p) | |
Variables | |
varargin = varargin(2:end) | |
numargin = nargin - 1 | |
endif | p = 0.1 |
x = 1:numel(y) | |
y = varargin{2} | |
endif | theaxis = [min(x), max(x), min(y), max(y)] |
num = numel (y) | |
dn = round (num/10) | |
for | n = 1:(num+dn) |
m = n - dn | |
k = min ([n, num]) | |
h = plot (x(1:m), y(1:m), "r", x(m:k), y(m:k), "g", x(k), y(k), "ob") | |
endfor endfunction!demo!clf | !t = 0:.1:2*pi |
!x = cos(2*t).*(cos(t).^2) | |
!y = sin(2*t).*(sin(t).^2) |
axis | ( | theaxis | ) |
function comet | ( | varargin | ) |
drawnow | ( | ) |
elseif | ( | numargin | = =2 |
) | = varargin{1} |
elseif | ( | numel(varargin{1}) | = = 1 && ishandle (varargin{1}) && strcmpi (get (varargin{1}, "type"), "axes") |
) |
if | ( | numargin | = =1 |
) |
pause | ( | p | ) |
else print_usage | ( | ) |
endfor endfunction !demo ! clf !t = 0:.1:2*pi |
!x = cos(2*t).*(cos(t).^2) |
!y = sin(2*t).*(sin(t).^2) |
m = n - dn |
num = numel (y) |
p = 0.1 |
varargin = varargin(2:end) |
x = 1:numel(y) |
y = varargin{2} |