Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - Русский

Change language to:
English - Français - 日本語 - Português -

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

Справка Scilab >> Графики > 3d_plot > comet3d


3D comet animated plot


comet3d(x, y, z)
comet3d(x, y, z, Lf)
comet3d(x, y, fun)
comet3d(x, y, fun, Lf)
comet3d(...,"colors", c)


a real vector or matrix. Default = 1:np, np being the number of points of the trajectory. As a matrix, each column defines the x coordinates of the trace of an individual comet.

a real vector (default value = 1:np) or matrix. As a matrix, each column defines the y coordinates of the trace of an individual comet.

a real vector of length np, or a matrix with np rows. As a matrix, each column defines the z coordinates of the trace of an individual comet. nc=size(z,"c") is the number of comets simultaneously drawn.

a real scalar in the interval[0,1[. Default value is 0.1: It defines the Leading fraction of the comet's trace. The k=Lf*np most recent points are plotted in thicker line.

a scilab function with syntax z=fun(x,y).

nc colors of the nc comets traces. They may be specified as a vector of nc color indices or color names or "#RRGGBB" hexadecimal color codes. Or by a matrix (ncx3) of [r,g,b] vectors of Red-Green-Blue intensities in the [0,1] interval.


If (x,y,z) are three vectors with the same number of elements, this function draws a 3D comet animated plot. The plot is made of three parts:

a head mark that shows the current (x(i),y(i),z(i)) position.
a body consisting in the k=round(Lf*np) most recent points of the trajectory, displayed as a thicker part of the trace.
a tail that shows the [x(1:i-k), y(1:i-k), z(1:i-k)] part of the curve.

if z is a matrix and x and y are vectors, then animated curves are drawn for each triple (x, y, z(:,j)).

if x,y,z are matrices with the same dimensions then animated curves are drawn for each triple (x(:,j), y(:,j), z(:,j)).

comet3d(x, y, fun,...) computes the z vector as z(i)=fun(x(i),y(i)).

comet3d(..,"colors",c) can be used to set the colors of each trajectory.


t = linspace(-%pi,%pi,500);
comet3d(sin(5*t), sin(t), t.^2)
t = linspace(-%pi,%pi,500)';
comet3d(sin(5*t), sin(t), [t.^2,ones(t)])
// Chosen colors:
t = linspace(0, 10*%pi, 500)';
clf, gca().rotation_angles = [26, 112];
comet3d(t.*sin(t), t, [t.*sin(2*t) t.*sin(3*t)], "colors", ["orange" "red"])
t = linspace(-%pi,%pi,500)';
function z=traj(x, y), z = 1.5*sin(x^2)*cos(y), endfunction

See also

  • comet — двумерный график с анимированной кометой
  • paramfplot2d — animated plot of a 2D parametrized curve.
  • realtime — sets the time unit
  • colors names — list of named colors


5.3.2 Function comet3d() introduced.
6.1.0 Colors can now be specified also by their name, or by their "#RRGGBB" hexadecimal code, or by their [r g b] Red-Green-Blue intensities.
Report an issue
<< bar3d 3d_plot contour >>

Copyright (c) 2022-2023 (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 Feb 25 08:54:58 CET 2020