608156886f0697b1b91b265f7c5ed5cc46636e40
[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>noise generation</refpurpose>
20     </refnamediv>
21     <refsynopsisdiv>
22         <title>Syntax</title>
23         <synopsis>b = noisegen(pas, Tmax, sig)</synopsis>
24     </refsynopsisdiv>
25     <refsection>
26         <title>Arguments</title>
27         <variablelist>
28             <varlistentry>
29                 <term>pas</term>
30                 <listitem>
31                     <para>real scalar, the time increment</para>
32                 </listitem>
33             </varlistentry>
34             <varlistentry>
35                 <term>Tmax</term>
36                 <listitem>
37                     <para>real scalar, the final time of the interval of noise generation</para>
38                 </listitem>
39             </varlistentry>
40             <varlistentry>
41                 <term>sig</term>
42                 <listitem>
43                     <para>real scalar, the standard deviation of the noise</para>
44                 </listitem>
45             </varlistentry>
46         </variablelist>
47     </refsection>
48     <refsection>
49         <title>Description</title>
50         <para>
51             <literal>noisegen()</literal> generates a Scilab function <literal>b = Noise(t)</literal>
52             where <literal>Noise(t)</literal> is a piecewise constant function
53             (constant on  <literal>[k*pas, (k+1)*pas]</literal>). The value on each constant
54             interval are random values from i.i.d Gaussian variables of
55             standard deviation <literal>sig</literal>. The function is constant for <literal>t &lt;= 0</literal> and
56             <literal>t &gt;= Tmax</literal>.
57         </para>
58         <para>
59             <note>
60                 Note: Random number generator functions such as <link linkend="rand">rand</link> and
61                 <link linkend="grand">grand</link> are another alternative to generate noises
62                 from a wide variety of probability distribution (see example 2 below).
63             </note>
64         </para>
65     </refsection>
66     <refsection>
67         <title>Examples</title>
68         <para>
69             Example #1: noisegen()
70         </para>
71         <programlisting role="example"><![CDATA[
72 noisegen(0.5, 30, 1.0);
73 x = -5:0.01:35;
74 y = feval(x, Noise);
75 plot(x, y);
76  ]]></programlisting>
77         <scilab:image>
78             noisegen(0.5, 30, 1.0);
79             x = -5:0.01:35;
80             y = feval(x, Noise);
81             plot(x, y);
82         </scilab:image>
83         <para>
84             Example #2: rand()
85         </para>
86         <programlisting role="example"><![CDATA[
87 // Plot a zero mean gaussian white noise with the variance 1.
88 // To use a different variance, multiply rand() by the square root of the variance.
89 t = 0:.5:30;
90 sig = 1; // Standard deviation of the white gaussian noise
91 noise = sig*rand(t, "normal");
92 plot2d2(t, noise);
93  ]]></programlisting>
94         <scilab:image>
95             t = 0:.5:30;
96             sig = 1;
97             noise = sig*rand(t, "normal");
98             plot2d2(t, noise)
99         </scilab:image>
100     </refsection>
101     <refsection role="see also">
102         <title>See also</title>
103         <simplelist type="inline">
104             <member>
105                 <link linkend="rand">rand</link>
106             </member>
107             <member>
108                 <link linkend="grand">grand</link>
109             </member>
110         </simplelist>
111     </refsection>
112 </refentry>