File: Products-of-Polynomials.html

package info (click to toggle)
octave3.2 3.2.4-8
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 62,936 kB
  • ctags: 37,353
  • sloc: cpp: 219,497; fortran: 116,336; ansic: 10,264; sh: 5,508; makefile: 4,245; lex: 3,573; yacc: 3,062; objc: 2,042; lisp: 1,692; awk: 860; perl: 844
file content (226 lines) | stat: -rw-r--r-- 11,973 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<html lang="en">
<head>
<title>Products of Polynomials - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Polynomial-Manipulations.html#Polynomial-Manipulations" title="Polynomial Manipulations">
<link rel="prev" href="Finding-Roots.html#Finding-Roots" title="Finding Roots">
<link rel="next" href="Derivatives-and-Integrals.html#Derivatives-and-Integrals" title="Derivatives and Integrals">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Products-of-Polynomials"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Derivatives-and-Integrals.html#Derivatives-and-Integrals">Derivatives and Integrals</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Finding-Roots.html#Finding-Roots">Finding Roots</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Polynomial-Manipulations.html#Polynomial-Manipulations">Polynomial Manipulations</a>
<hr>
</div>

<h3 class="section">27.3 Products of Polynomials</h3>

<!-- ./polynomial/conv.m -->
<p><a name="doc_002dconv"></a>

<div class="defun">
&mdash; Function File:  <b>conv</b> (<var>a, b</var>)<var><a name="index-conv-2031"></a></var><br>
<blockquote><p>Convolve two vectors.

        <p><code>y = conv (a, b)</code> returns a vector of length equal to
<code>length (a) + length (b) - 1</code>. 
If <var>a</var> and <var>b</var> are polynomial coefficient vectors, <code>conv</code>
returns the coefficients of the product polynomial. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002ddeconv.html#doc_002ddeconv">deconv</a>, <a href="doc_002dpoly.html#doc_002dpoly">poly</a>, <a href="doc_002droots.html#doc_002droots">roots</a>, <a href="doc_002dresidue.html#doc_002dresidue">residue</a>, <a href="doc_002dpolyval.html#doc_002dpolyval">polyval</a>, <a href="doc_002dpolyderiv.html#doc_002dpolyderiv">polyderiv</a>, <a href="doc_002dpolyinteg.html#doc_002dpolyinteg">polyinteg</a>. 
</p></blockquote></div>

<!-- ./polynomial/convn.m -->
   <p><a name="doc_002dconvn"></a>

<div class="defun">
&mdash; Function File: <var>c</var> = <b>convn</b> (<var>a, b, shape</var>)<var><a name="index-convn-2032"></a></var><br>
<blockquote><p>N-dimensional convolution of matrices <var>a</var> and <var>b</var>.

        <p>The size of the output is determined by the <var>shape</var> argument. 
This can be any of the following character strings:

          <dl>
<dt>"full"<dd>The full convolution result is returned.  The size out of the output is
<code>size (</code><var>a</var><code>) + size (</code><var>b</var><code>)-1</code>.  This is the default behavior. 
<br><dt>"same"<dd>The central part of the convolution result is returned.  The size out of the
output is the same as <var>a</var>. 
<br><dt>"valid"<dd>The valid part of the convolution is returned.  The size of the result is
<code>max (size (</code><var>a</var><code>) - size (</code><var>b</var><code>)+1, 0)</code>. 
</dl>

     <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002dconv.html#doc_002dconv">conv</a>, <a href="doc_002dconv2.html#doc_002dconv2">conv2</a>. 
</p></blockquote></div>

<!-- ./polynomial/deconv.m -->
   <p><a name="doc_002ddeconv"></a>

<div class="defun">
&mdash; Function File:  <b>deconv</b> (<var>y, a</var>)<var><a name="index-deconv-2033"></a></var><br>
<blockquote><p>Deconvolve two vectors.

        <p><code>[b, r] = deconv (y, a)</code> solves for <var>b</var> and <var>r</var> such that
<code>y = conv (a, b) + r</code>.

        <p>If <var>y</var> and <var>a</var> are polynomial coefficient vectors, <var>b</var> will
contain the coefficients of the polynomial quotient and <var>r</var> will be
a remainder polynomial of lowest order. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dconv.html#doc_002dconv">conv</a>, <a href="doc_002dpoly.html#doc_002dpoly">poly</a>, <a href="doc_002droots.html#doc_002droots">roots</a>, <a href="doc_002dresidue.html#doc_002dresidue">residue</a>, <a href="doc_002dpolyval.html#doc_002dpolyval">polyval</a>, <a href="doc_002dpolyderiv.html#doc_002dpolyderiv">polyderiv</a>, <a href="doc_002dpolyinteg.html#doc_002dpolyinteg">polyinteg</a>. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/conv2.cc -->
   <p><a name="doc_002dconv2"></a>

<div class="defun">
&mdash; Loadable Function: y = <b>conv2</b> (<var>a, b, shape</var>)<var><a name="index-conv2-2034"></a></var><br>
&mdash; Loadable Function: y = <b>conv2</b> (<var>v1, v2, M, shape</var>)<var><a name="index-conv2-2035"></a></var><br>
<blockquote>
        <p>Returns 2D convolution of <var>a</var> and <var>b</var> where the size
of <var>c</var> is given by

          <dl>
<dt><var>shape</var>= 'full'<dd>returns full 2-D convolution
<br><dt><var>shape</var>= 'same'<dd>same size as a. 'central' part of convolution
<br><dt><var>shape</var>= 'valid'<dd>only parts which do not include zero-padded edges
</dl>

        <p>By default <var>shape</var> is 'full'.  When the third argument is a matrix
returns the convolution of the matrix <var>M</var> by the vector <var>v1</var>
in the column direction and by vector <var>v2</var> in the row direction
</p></blockquote></div>

<!-- ./polynomial/polygcd.m -->
   <p><a name="doc_002dpolygcd"></a>

<div class="defun">
&mdash; Function File: <var>q</var> = <b>polygcd</b> (<var>b, a, tol</var>)<var><a name="index-polygcd-2036"></a></var><br>
<blockquote>
        <p>Find greatest common divisor of two polynomials.  This is equivalent
to the polynomial found by multiplying together all the common roots. 
Together with deconv, you can reduce a ratio of two polynomials. 
Tolerance defaults to
     <pre class="example">          sqrt(eps).
</pre>
        <p>Note that this is an unstable
algorithm, so don't try it on large polynomials.

        <p>Example
     <pre class="example">          polygcd (poly(1:8), poly(3:12)) - poly(3:8)
           [ 0, 0, 0, 0, 0, 0, 0 ]
          deconv (poly(1:8), polygcd (poly(1:8), poly(3:12))) ...
            - poly(1:2)
           [ 0, 0, 0 ]
</pre>
        <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002dpoly.html#doc_002dpoly">poly</a>, <a href="doc_002dpolyinteg.html#doc_002dpolyinteg">polyinteg</a>, <a href="doc_002dpolyderiv.html#doc_002dpolyderiv">polyderiv</a>, <a href="doc_002dpolyreduce.html#doc_002dpolyreduce">polyreduce</a>, <a href="doc_002droots.html#doc_002droots">roots</a>, <a href="doc_002dconv.html#doc_002dconv">conv</a>, <a href="doc_002ddeconv.html#doc_002ddeconv">deconv</a>, <a href="doc_002dresidue.html#doc_002dresidue">residue</a>, <a href="doc_002dfilter.html#doc_002dfilter">filter</a>, <a href="doc_002dpolyval.html#doc_002dpolyval">polyval</a>, <a href="doc_002dpolyvalm.html#doc_002dpolyvalm">polyvalm</a>. 
</p></blockquote></div>

<!-- ./polynomial/residue.m -->
   <p><a name="doc_002dresidue"></a>

<div class="defun">
&mdash; Function File: [<var>r</var>, <var>p</var>, <var>k</var>, <var>e</var>] = <b>residue</b> (<var>b, a</var>)<var><a name="index-residue-2037"></a></var><br>
<blockquote><p>Compute the partial fraction expansion for the quotient of the
polynomials, <var>b</var> and <var>a</var>.

     <pre class="example">           B(s)    M       r(m)         N
           ---- = SUM -------------  + SUM k(i)*s^(N-i)
           A(s)   m=1 (s-p(m))^e(m)    i=1
</pre>
        <p class="noindent">where M is the number of poles (the length of the <var>r</var>,
<var>p</var>, and <var>e</var>), the <var>k</var> vector is a polynomial of order N-1
representing the direct contribution, and the <var>e</var> vector specifies
the multiplicity of the m-th residue's pole.

        <p>For example,

     <pre class="example">          b = [1, 1, 1];
          a = [1, -5, 8, -4];
          [r, p, k, e] = residue (b, a);
                r = [-2; 7; 3]
                p = [2; 2; 1]
                k = [](0x0)
                e = [1; 2; 1]
</pre>
        <p class="noindent">which represents the following partial fraction expansion

     <pre class="example">                  s^2 + s + 1       -2        7        3
             ------------------- = ----- + ------- + -----
             s^3 - 5s^2 + 8s - 4   (s-2)   (s-2)^2   (s-1)
</pre>
        &mdash; Function File: [<var>b</var>, <var>a</var>] = <b>residue</b> (<var>r, p, k</var>)<var><a name="index-residue-2038"></a></var><br>
&mdash; Function File: [<var>b</var>, <var>a</var>] = <b>residue</b> (<var>r, p, k, e</var>)<var><a name="index-residue-2039"></a></var><br>
<blockquote><p>Compute the reconstituted quotient of polynomials,
<var>b</var>(s)/<var>a</var>(s), from the partial fraction expansion;
represented by the residues, poles, and a direct polynomial specified
by <var>r</var>, <var>p</var> and <var>k</var>, and the pole multiplicity <var>e</var>.

        <p>If the multiplicity, <var>e</var>, is not explicitly specified the multiplicity is
determined by the script mpoles.m.

        <p>For example,

     <pre class="example">          r = [-2; 7; 3];
          p = [2; 2; 1];
          k = [1, 0];
          [b, a] = residue (r, p, k);
                b = [1, -5, 9, -3, 1]
                a = [1, -5, 8, -4]
          
          where mpoles.m is used to determine e = [1; 2; 1]
</pre>
        <p>Alternatively the multiplicity may be defined explicitly, for example,

     <pre class="example">          r = [7; 3; -2];
          p = [2; 1; 2];
          k = [1, 0];
          e = [2; 1; 1];
          [b, a] = residue (r, p, k, e);
                b = [1, -5, 9, -3, 1]
                a = [1, -5, 8, -4]
</pre>
        <p class="noindent">which represents the following partial fraction expansion

     <pre class="example">              -2        7        3         s^4 - 5s^3 + 9s^2 - 3s + 1
             ----- + ------- + ----- + s = --------------------------
             (s-2)   (s-2)^2   (s-1)          s^3 - 5s^2 + 8s - 4
</pre>
        <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002dpoly.html#doc_002dpoly">poly</a>, <a href="doc_002droots.html#doc_002droots">roots</a>, <a href="doc_002dconv.html#doc_002dconv">conv</a>, <a href="doc_002ddeconv.html#doc_002ddeconv">deconv</a>, <a href="doc_002dmpoles.html#doc_002dmpoles">mpoles</a>, <a href="doc_002dpolyval.html#doc_002dpolyval">polyval</a>, <a href="doc_002dpolyderiv.html#doc_002dpolyderiv">polyderiv</a>, <a href="doc_002dpolyinteg.html#doc_002dpolyinteg">polyinteg</a>. 
</p></blockquote></div>

   </body></html>