octave: Products of Polynomials

 
 28.3 Products of Polynomials
 ============================
 
  -- : conv (A, B)
  -- : conv (A, B, SHAPE)
      Convolve two vectors A and B.
 
      The output convolution is a vector with length equal to ‘length (A)
      + length (B) - 1’.  When A and B are the coefficient vectors of two
      polynomials, the convolution represents the coefficient vector of
      the product polynomial.
 
      The optional SHAPE argument may be
 
      SHAPE = "full"
           Return the full convolution.  (default)
 
      SHAPE = "same"
           Return the central part of the convolution with the same size
           as A.
 
DONTPRINTYET       See also: Seedeconv XREFdeconv, Seeconv2 XREFconv2, *noteDONTPRINTYET       See also: Seedeconv XREFdeconv, Seeconv2 XREFconv2, See
      convn XREFconvn, Seefftconv XREFfftconv.
 
  -- : C = convn (A, B)
  -- : C = convn (A, B, SHAPE)
      Return the n-D convolution of A and B.
 
      The size of the result is determined by the optional SHAPE argument
      which takes the following values
 
      SHAPE = "full"
           Return the full convolution.  (default)
 
      SHAPE = "same"
           Return central part of the convolution with the same size as
           A.  The central part of the convolution begins at the indices
           ‘floor ([size(B)/2] + 1)’.
 
      SHAPE = "valid"
           Return only the parts which do not include zero-padded edges.
           The size of the result is ‘max (size (A) - size (B) + 1, 0)’.
 
      See also: Seeconv2 XREFconv2, Seeconv XREFconv.
 
  -- : deconv (Y, A)
      Deconvolve two vectors.
 
      ‘[b, r] = deconv (y, a)’ solves for B and R such that ‘y = conv (a,
      b) + r’.
 
      If Y and A are polynomial coefficient vectors, B will contain the
      coefficients of the polynomial quotient and R will be a remainder
      polynomial of lowest order.
 
      See also: Seeconv XREFconv, Seeresidue XREFresidue.
 
  -- : conv2 (A, B)
  -- : conv2 (V1, V2, M)
  -- : conv2 (..., SHAPE)
      Return the 2-D convolution of A and B.
 
      The size of the result is determined by the optional SHAPE argument
      which takes the following values
 
      SHAPE = "full"
           Return the full convolution.  (default)
 
      SHAPE = "same"
           Return the central part of the convolution with the same size
           as A.  The central part of the convolution begins at the
           indices ‘floor ([size(B)/2] + 1)’.
 
      SHAPE = "valid"
           Return only the parts which do not include zero-padded edges.
           The size of the result is ‘max (size (A) - size (B) + 1, 0)’.
 
      When the third argument is a matrix, return the convolution of the
      matrix M by the vector V1 in the column direction and by the vector
      V2 in the row direction.
 
      See also: Seeconv XREFconv, Seeconvn XREFconvn.
 
  -- : Q = polygcd (B, A)
  -- : Q = polygcd (B, A, TOL)
 
      Find the 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.
 
      The tolerance TOL defaults to ‘sqrt (eps)’.
 
      *Caution:* This is a numerically unstable algorithm and should not
      be used on large polynomials.
 
      Example code:
 
           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 ]
 
DONTPRINTYET       See also: Seepoly XREFpoly, Seeroots XREFroots, *noteconv:
DONTPRINTYET       See also: Seepoly XREFpoly, Seeroots XREFroots, Seeconv

      XREFconv, Seedeconv XREFdeconv, Seeresidue XREFresidue.
 
  -- : [R, P, K, E] = residue (B, A)
  -- : [B, A] = residue (R, P, K)
  -- : [B, A] = residue (R, P, K, E)
      The first calling form computes the partial fraction expansion for
      the quotient of the polynomials, B and A.
 
      The quotient is defined as
 
           B(s)    M       r(m)        N
           ---- = SUM ------------- + SUM k(i)*s^(N-i)
           A(s)   m=1 (s-p(m))^e(m)   i=1
 
      where M is the number of poles (the length of the R, P, and E), the
      K vector is a polynomial of order N-1 representing the direct
      contribution, and the E vector specifies the multiplicity of the
      m-th residue’s pole.
 
      For 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]
 
      which represents the following partial fraction expansion
 
                   s^2 + s + 1       -2        7        3
              ------------------- = ----- + ------- + -----
              s^3 - 5s^2 + 8s - 4   (s-2)   (s-2)^2   (s-1)
 
      The second calling form performs the inverse operation and computes
      the reconstituted quotient of polynomials, B(s)/A(s), from the
      partial fraction expansion; represented by the residues, poles, and
      a direct polynomial specified by R, P and K, and the pole
      multiplicity E.
 
      If the multiplicity, E, is not explicitly specified the
      multiplicity is determined by the function ‘mpoles’.
 
      For 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 is used to determine e = [1; 2; 1]
 
      Alternatively the multiplicity may be defined explicitly, for
      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]
 
      which represents the following partial fraction expansion
 
            -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
 
DONTPRINTYET       See also: Seempoles XREFmpoles, Seepoly XREFpoly, *noteDONTPRINTYET       See also: Seempoles XREFmpoles, Seepoly XREFpoly, See
      roots XREFroots, Seeconv XREFconv, Seedeconv XREFdeconv.