Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.4.1 - Português

Change language to:
English - Français - 日本語 - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Ajuda Scilab >> Biblioteca de Gráficos > 2d_plot > comet

comet

2D comet animated plot.

Calling Sequence

comet(y)
comet(x,y)
comet(x,fun)
comet(x,y,p)
comet(x,fun,p)
comet(...,"colors",c)

Parameters

x

a real vector or matrix. If omitted, it is assumed to be the vector 1:ny where ny is the number of curve points (see below).

y

a real vector or matrix of length.

p

a real scalar in the interval[0 1[. Default value is 0.1.

fun

a scilab function with calling sequence y=fun(x). fun can also be a polynomial or a rational fraction.

c

a vector of ny color index.

Description

If (x,y) are two vectors with the same number of elements, this function draws a 2D comet animated plot showing the progession of the curve (x(1:k),y(1:k)) for k varying from 1 to size(x,'*').

The plot is made of three parts:

a head

mark that shows the current (x(i),y(i)) position.

a body

that shows the trailing curve that follows the head: the (x(i-k:i),y(i-k:i)) part of the curve.

a tail

that shows the (x(1:i-k),y(1:i-k)) part of the curve.

comet(x,fun,...) is equivalent to comet(x,feval(x,fun),...).

comet(...,p) can be used to set the relative length of the body. k is defined as k = round(p*ny).

If y is a matrix then animated curves are drawn for each pair (x,y(:,l)). In this case ny is the number of rows of y.

If x and y are matrices with identical sizes then animated curves are drawn for each pair (x(:,l),y(:,l)). In this case ny is the number of rows of x and y.

comet(...,"colors",c) can be used to set the colors of each curves.

Examples

t = linspace(0,10*%pi,500);
clf();
set(gca(),"isoview","on"); //set isoview axes
comet(t.*sin(t), t.*cos(t))
t = linspace(0,10*%pi,500)';
clf();
comet(t.*sin(t), [t.*sin(2*t) t.*sin(3*t)])
t = linspace(0,10*%pi,500)';
clf();comet(t.*sin(t),[t.*sin(2*t) t.*sin(3*t)],"colors",[3 5])
function y=traj(x)
  y=1.5*sin(x^2)
endfunction
clf();
comet(linspace(0,5,500),traj)
clf();
comet(linspace(-2,4,500), (%s-3)/(%s^3+2*%s^2+1))

See Also

  • color — Retorna o identificador de uma cor
  • comet3d — 3D comet animated plot.
  • paramfplot2d — Esboço animado 2d, curva definida por uma função

History

VersionDescription
5.3.2 Function comet introduced.
Report an issue
<< polarplot 2d_plot fec properties >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Apr 02 17:37:05 CEST 2013