help pages: toeplitz overhauled. diag, sparse, speye improved
[scilab.git] / scilab / modules / elementary_functions / help / pt_BR / elementarymatrices / diag.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) 2008 - 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"
17           xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml"
18           xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
19           xmlns:scilab="http://www.scilab.org" xml:id="diag" xml:lang="pt">
20     <refnamediv>
21         <refname>diag</refname>
22         <refpurpose>inclusão ou extração diagonal</refpurpose>
23     </refnamediv>
24     <refsynopsisdiv>
25         <title>Seqüência de Chamamento</title>
26         <synopsis>
27            y = diag(vm)
28            y = diag(vm, k)
29         </synopsis>
30     </refsynopsisdiv>
31     <refsection>
32         <title>Parâmetros</title>
33         <variablelist>
34             <varlistentry>
35                 <term>vm</term>
36                 <listitem>
37                     <para>vetor ou matriz (armazenamento cheio ou esparso)</para>
38                 </listitem>
39             </varlistentry>
40             <varlistentry>
41                 <term>k</term>
42                 <listitem>
43                     <para>inteiro (o valor padrão é 0)</para>
44                 </listitem>
45             </varlistentry>
46             <varlistentry>
47                 <term>y</term>
48                 <listitem>
49                     <para>vetor ou matriz</para>
50                 </listitem>
51             </varlistentry>
52         </variablelist>
53     </refsection>
54     <refsection>
55         <title>Descrição</title>
56         <para>
57             Para um n-vetor (linha ou coluna) <literal>vm</literal> ,
58             <literal>diag(vm)</literal> retorna uma matriz diagonal com entradas de
59             <literal>vm</literal> ao longo da diagonal principal.
60         </para>
61         <para>
62             <literal>diag(vm,k)</literal> é uma matriz
63             <literal>(n+abs(k))x(n+abs(k))</literal> com entradas de
64             <literal>vm</literal> ao longo da k-ésima diagonal. <literal>k=0</literal>
65             é a diagonal principal, <literal>k&gt;0</literal> são as diagonais
66             superiores e <literal>k&lt;0</literal> são as diagonais inferiores.
67         </para>
68         <para>
69             Para uma matriz <literal>vm</literal>, <literal>diag(vm,k)</literal>
70             é o vetor coluna feito das entradas da k-ésima diagonal de
71             <literal>vm</literal>. <literal>diag(vm)</literal> é a diagonal principal
72             de <literal>vm</literal>. <literal>diag(diag(x))</literal> é a matriz
73             diagonal.
74         </para>
75         <para>
76             Se <literal>vm</literal> é uma matriz esparsa,
77             <literal>diag(vm,k)</literal> retorna uma matriz esparsa.
78         </para>
79         <para>Para construir um sistema linear diagonal, use
80             <literal>sysdiag</literal>.
81         </para>
82         <para>
83             Perceba que <literal>eye(A).*A</literal> retorna uma matriz diagonal
84             feita das entradas diagonais de <literal>A</literal>. Isto é válido para
85             qualquer matriz (constante, de polinômios, de razões de polinômios,
86             sistema linear em espaço de estados,...).
87         </para>
88     </refsection>
89     <refsection>
90         <title>Exemplos</title>
91         <programlisting role="example"><![CDATA[
92 diag([1,2])
93
94 A=[1,2;3,4];
95 diag(A)  // diagonal principal
96 diag(A,1)
97
98 diag(sparse(1:10))  // matriz diagonal esparsa
99
100 // forma de uma matriz triadiagonal de tamanho 2*m+1
101 m=5;diag(-m:m) +  diag(ones(2*m,1),1) +diag(ones(2*m,1),-1)
102  ]]></programlisting>
103     </refsection>
104     <refsection role="see also">
105         <title>Ver Também</title>
106         <simplelist type="inline">
107             <member>
108                 <link linkend="toeplitz">toeplitz</link>
109             </member>
110             <member>
111                 <link linkend="eye">eye</link>
112             </member>
113             <member>
114                 <link linkend="sysdiag">sysdiag</link>
115             </member>
116             <member>
117                 <link linkend="spec">spec</link>
118             </member>
119             <member>
120                 <link linkend="bdiag">bdiag</link>
121             </member>
122         </simplelist>
123     </refsection>
124 </refentry>