# comet3d

3D comet animated plot

### Syntax

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

### Parameters

- x
- 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. - y
- 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. - z
- 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. - Lf
- 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. - fun
- a scilab function with syntax
`z=fun(x,y)`

. - c
`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.

### Description

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.

### Examples

### See also

- comet — 2D comet animated plot
- paramfplot2d — animated plot of a 2D parametrized curve.
- realtime — sets the time unit
- colors names — list of named colors

### History

Version | Description |

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 >> |