File: histplot.xml

package info (click to toggle)
scilab 5.2.2-9
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 334,832 kB
  • ctags: 52,586
  • sloc: xml: 526,945; ansic: 223,590; fortran: 163,080; java: 56,934; cpp: 33,840; tcl: 27,936; sh: 20,397; makefile: 9,908; ml: 9,451; perl: 1,323; cs: 614; lisp: 30
file content (166 lines) | stat: -rw-r--r-- 5,581 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) INRIA - Serge Steer
 * 
 * This file must be used under the terms of the CeCILL.
 * This source file is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at    
 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
 *
 -->
<refentry version="5.0-subset Scilab" xml:id="histplot" xml:lang="en"
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:svg="http://www.w3.org/2000/svg"
          xmlns:ns5="http://www.w3.org/1999/xhtml"
          xmlns:mml="http://www.w3.org/1998/Math/MathML"
          xmlns:db="http://docbook.org/ns/docbook">
  <info>
    <pubdate>$LastChangedDate$</pubdate>
  </info>

  <refnamediv>
    <refname>histplot</refname>

    <refpurpose>esboa um histograma</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <title>Seqncia de Chamamento</title>

    <synopsis>histplot(n, data, &lt;opt_args&gt;)
histplot(x, data, &lt;opt_args&gt;)</synopsis>
  </refsynopsisdiv>

  <refsection>
    <title>Parmetros</title>

    <variablelist>
      <varlistentry>
        <term>n</term>

        <listitem>
          <para>inteiro positivo (nmero de classes) </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term>x</term>

        <listitem>
          <para>vetor crescente definindo as classes (<literal>x</literal>
          pode ter pelo menos dois componentes) </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term>data</term>

        <listitem>
          <para>vetor (dados a serem analisados) </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term>&lt;opt_args&gt;</term>

        <listitem>
          <para>representa uma seqncia de declaraes
          <literal>key1=value1,key2=value2</literal> ,... onde
          <literal>key1</literal>, <literal>key2,...</literal> pode ser
          qualquer normalizao ou parmetro de <link
          linkend="plot2d">plot2d</link> opcional (<literal>style,strf,leg,
          rect,nax, logflag,frameflag, axesflag</literal>) No caso de
          normalizao, o valor correspondente deve ser um escalar booleano
          (valor padro %t). </para>
        </listitem>
      </varlistentry>
    </variablelist>
  </refsection>

  <refsection>
    <title>Descrio</title>

    <para>Esta funo esboa um histograma do vetor <literal>data</literal>
    utilizando classes <literal>x</literal>. Quando o nmero
    <literal>n</literal> de classes  fornecido ao invs de
    <literal>x</literal>, as classes so escolhidas de modo igualmente
    espaado e <emphasis>x(1) = min(data) &lt; x(2) = x(1) + dx &lt; ... &lt;
    x(n+1) = max(data)</emphasis> com <emphasis>dx =
    (x(n+1)-x(1))/n</emphasis>.</para>

    <para>As classes so definidas por C1 = [x(1), x(2)] e Ci = ( x(i),
    x(i+1)] para i &gt;= 2. Notando Nmax o nmero total de
    <literal>data</literal> (Nmax = comprimento de data) e Ni o nmero de
    componentes de <literal>data</literal> em Ci, o valor do histograma para x
    em Ci  igual a <emphasis>Ni/(Nmax (x(i+1)-x(i)))</emphasis> quando
    <literal>normalization</literal> (normalizao) for verdadeiro (caso
    padro) seno,  simplesmente igual a Ni. Quando a normalizao ocorre, o
    histograma verifica: </para>

    <programlisting role = ""><![CDATA[ 
 x(n+1)
/  
|   h(x) dx = 1,  when x(1)<=min(data) e max(data) <= x(n+1)) 
/
 x(1)
 ]]></programlisting>

    <para>Qualquer <link linkend="plot2d">plot2d</link> parmetro (opcional)
    pode ser fornecido; por exemplo, para esboar um histograma com a cor
    nmero 2 (azul, se o mapa de cores padro for utilizado) e para restringir
    o esboo ao retngulo [-3,3]x[0,0.5], voc pode utilizar
    <literal>histplot(n,data, style=2, rect=[-3,0,3,0.5])</literal>.</para>

    <para>Entre com o comando <literal>histplot()</literal> para visualizar
    uma demonstrao.</para>
  </refsection>

  <refsection>
    <title>Exemplos</title>

    <programlisting role="example"><![CDATA[ 
// exemplo #1: variaes ao redor de um histograma de uma amostra gaussiana aleatria
d=rand(1,10000,'normal');  // a amostra gaussiana aleatria
clf();histplot(20,d)
clf();histplot(20,d,normalization=%f)
clf();histplot(20,d,leg='rand(1,10000,''normal'')',style=5)
clf();histplot(20,d,leg='rand(1,10000,''normal'')',style=16, rect=[-3,0,3,0.5]); 

// exemplo #2: histograma de uma amsostra binomial (B(6,0.5)) aleatria
d = grand(1000,1,"bin", 6, 0.5);
c = linspace(-0.5,6.5,8);
xbasc()
subplot(2,1,1)
   histplot(c, d, style=2)
   xtitle("histograma normalizado")
subplot(2,1,2)
   histplot(c, d, normalization=%f, style=5)
   xtitle("histograma no normalizado")

// exemplo #3: histograma de uma amostra exponencial aleatria
lambda = 2;
X = grand(100000,1,"exp", 1/lambda);
Xmax = max(X);
xbasc()
histplot(40, X, style=2)
x = linspace(0,max(Xmax),100)';
plot2d(x,lambda*exp(-lambda*x),strf="000",style=5)
legend(["histograma de amostra exponencial aleatria" "curva de densidade exata"]);
 ]]></programlisting>
  </refsection>

  <refsection>
    <title>Ver Tambm </title>

    <simplelist type="inline">
      <member><link linkend="hist3d">hist3d</link></member>

      <member><link linkend="plot2d">plot2d</link></member>

      <member><link linkend="dsearch">dsearch</link></member>
    </simplelist>
  </refsection>
</refentry>