<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.13"> <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"> <a name="Products-of-Polynomials"></a> <p> Next: <a rel="next" accesskey="n" href="Derivatives-and-Integrals.html#Derivatives-and-Integrals">Derivatives and Integrals</a>, Previous: <a rel="previous" accesskey="p" href="Finding-Roots.html#Finding-Roots">Finding Roots</a>, Up: <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"> — 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"> — 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"> — 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"> — Loadable Function: y = <b>conv2</b> (<var>a, b, shape</var>)<var><a name="index-conv2-2034"></a></var><br> — 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"> — 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"> — 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> — 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> — 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>