1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) Serge Steer
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
15 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en_US" xml:id="comet">
17 <refname>comet</refname>
18 <refpurpose>2D comet animated plot. </refpurpose>
32 <title>Parameters</title>
38 a real vector or matrix. If omitted, it is assumed to be the vector
39 <literal>1:ny</literal> where <literal>ny</literal> is the
40 number of curve points (see below).
48 a real vector or matrix of length.
56 a real scalar in the interval<literal>[0 1[</literal>. Default value is 0.1.
64 a scilab function with syntax <literal>y=fun(x)</literal>. <varname>fun</varname> can also be a polynomial or a rational fraction.
72 a vector of <literal>ny</literal> color index.
79 <title>Description</title>
81 If <literal>(x,y)</literal> are two vectors with the same number
82 of elements, this function draws a 2D comet animated plot
83 showing the progression of the curve
84 <literal>(x(1:k),y(1:k))</literal> for <literal>k</literal>
85 varying from <literal>1</literal> to
86 <literal>size(x,'*')</literal>.
89 The plot is made of three parts:
95 mark that shows the current <literal>(x(i),y(i))</literal> position.
103 that shows the trailing curve that follows the head: the
104 <literal>(x(i-k:i),y(i-k:i))</literal> part of the curve.
112 that shows the <literal>(x(1:i-k),y(1:i-k))</literal> part of the curve.
118 <literal>comet(x,fun,...)</literal> is equivalent to <literal>comet(x,feval(x,fun),...)</literal>.
121 <literal>comet(...,p)</literal> can be used to set the
122 relative length of the body. <literal>k</literal> is defined
123 as <code>k = round(p*ny)</code>.
126 If <varname>y</varname> is a matrix then animated curves
127 are drawn for each pair <literal>(x,y(:,l))</literal>.
128 In this case <literal>ny</literal> is the number of rows
129 of <varname>y</varname>.
132 If <varname>x</varname> and <varname>y</varname> are
133 matrices with identical sizes then animated curves are drawn
134 for each pair <literal>(x(:,l),y(:,l))</literal>. In this
135 case <literal>ny</literal> is the number of rows of
136 <varname>x</varname> and <varname>y</varname>.
140 <literal>comet(...,"colors",c)</literal> can be used to set the colors of each curves.
146 <title>Examples</title>
147 <programlisting role="example"><![CDATA[
148 t = linspace(0,10*%pi,500);
150 isoview; //set isoview axes
151 comet(t.*sin(t), t.*cos(t))
153 <programlisting role="example"><![CDATA[
154 t = linspace(0,10*%pi,500)';
156 comet(t.*sin(t), [t.*sin(2*t) t.*sin(3*t)])
158 <programlisting role="example"><![CDATA[
159 t = linspace(0,10*%pi,500)';
160 clf();comet(t.*sin(t),[t.*sin(2*t) t.*sin(3*t)],"colors",[3 5])
162 <programlisting role="example"><![CDATA[
167 comet(linspace(0,5,500),traj)
169 <programlisting role="example"><![CDATA[
171 comet(linspace(-2,4,500), (%s-3)/(%s^3+2*%s^2+1))
174 <refsection role="see also">
175 <title>See also</title>
176 <simplelist type="inline">
178 <link linkend="color">color</link>
181 <link linkend="comet3d">comet3d</link>
184 <link linkend="paramfplot2d">paramfplot2d</link>
189 <title>History</title>
192 <revnumber>5.3.2</revnumber>
194 Function <function>comet</function> introduced.