* Bug 16166 fixed: noisegen() obsolete
[scilab.git] / scilab / modules / cacsd / help / en_US / noisegen.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) INRIA -
5  *
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
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.
14  *
15  -->
16 <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" xml:id="noisegen">
17     <refnamediv>
18         <refname>noisegen</refname>
19         <refpurpose>
20             noise generation <emphasis role="bold">(obsolete)</emphasis>
21         </refpurpose>
22     </refnamediv>
23     <refsynopsisdiv>
24         <title>Syntax</title>
25         <synopsis>b = noisegen(pas, Tmax, sig)</synopsis>
26     </refsynopsisdiv>
27     <refsection>
28         <title>Arguments</title>
29         <variablelist>
30             <varlistentry>
31                 <term>pas</term>
32                 <listitem>
33                     <para>real scalar, the time increment</para>
34                 </listitem>
35             </varlistentry>
36             <varlistentry>
37                 <term>Tmax</term>
38                 <listitem>
39                     <para>real scalar, the final time of the interval of noise generation</para>
40                 </listitem>
41             </varlistentry>
42             <varlistentry>
43                 <term>sig</term>
44                 <listitem>
45                     <para>real scalar, the standard deviation of the noise</para>
46                 </listitem>
47             </varlistentry>
48         </variablelist>
49     </refsection>
50     <refsection>
51         <title>Description</title>
52         <warning>
53             <literal>noisegen()</literal> is obsolete. It will be removed from Scilab 6.1.x.
54             Please use grand() instead. Examples (clearer, shorter, and more powerful) follow:
55             <para/>
56             <para>
57             100 10-point wide steps with random amplitudes of normal distribution
58             of mean 1 and standard deviation 0.7:
59             </para>
60             <programlisting role="example"><![CDATA[
61             u = grand(1,100,"nor",1,0.7) .*. ones(1,10);
62             clf, plot(u);
63             ]]></programlisting>
64             <para/>
65             <para>
66             40 15-point wide steps with random amplitudes of uniform distribution in [1 3],
67             with initial level 0.5 and final level hold:
68             </para>
69             <programlisting role="example"><![CDATA[
70             width = 15;
71             u = grand(1,40, "unf", 1, 3) .*. ones(1,width);
72             u = [ones(1,8*width)*0.5, u, ones(1,5*width)*u($)];
73             clf, plot(u);
74             ]]></programlisting>
75         </warning>
76         <para>
77             <literal>noisegen()</literal> generates a Scilab function <literal>b = Noise(t)</literal>
78             where <literal>Noise(t)</literal> is a piecewise constant function
79             (constant on  <literal>[k*pas, (k+1)*pas]</literal>). The value on each constant
80             interval are random values from i.i.d Gaussian variables of
81             standard deviation <literal>sig</literal>. The function is constant for <literal>t &lt;= 0</literal> and
82             <literal>t &gt;= Tmax</literal>.
83         </para>
84         <para>
85             <note>
86                 Note: Random number generator functions such as <link linkend="rand">rand</link> and
87                 <link linkend="grand">grand</link> are another alternative to generate noises
88                 from a wide variety of probability distribution (see example 2 below).
89             </note>
90         </para>
91     </refsection>
92     <refsection>
93         <title>Examples</title>
94         <para>
95             Example #1: noisegen()
96         </para>
97         <programlisting role="example"><![CDATA[
98 noisegen(0.5, 30, 1.0);
99 x = -5:0.01:35;
100 y = feval(x, Noise);
101 plot(x, y);
102  ]]></programlisting>
103         <scilab:image>
104             noisegen(0.5, 30, 1.0);
105             x = -5:0.01:35;
106             y = feval(x, Noise);
107             plot(x, y);
108         </scilab:image>
109         <para>
110             Example #2: rand()
111         </para>
112         <programlisting role="example"><![CDATA[
113 // Plot a zero mean gaussian white noise with the variance 1.
114 // To use a different variance, multiply rand() by the square root of the variance.
115 t = 0:.5:30;
116 sig = 1; // Standard deviation of the white gaussian noise
117 noise = sig*rand(t, "normal");
118 plot2d2(t, noise);
119  ]]></programlisting>
120         <scilab:image>
121             t = 0:.5:30;
122             sig = 1;
123             noise = sig*rand(t, "normal");
124             plot2d2(t, noise)
125         </scilab:image>
126     </refsection>
127     <refsection role="see also">
128         <title>See also</title>
129         <simplelist type="inline">
130             <member>
131                 <link linkend="rand">rand</link>
132             </member>
133             <member>
134                 <link linkend="grand">grand</link>
135             </member>
136         </simplelist>
137     </refsection>
138     <refsection role="history">
139         <title>History</title>
140         <revhistory>
141             <revision>
142                 <revnumber>6.1.0</revnumber>
143                 <revdescription>
144                     noisegen() is obsolete. It will be removed from Scilab 6.1.x.
145                     Please replace it with grand() and .*.
146                 </revdescription>
147             </revision>
148         </revhistory>
149     </refsection>
150 </refentry>