In Octave, a polynomial is represented by its coefficients (arranged in descending order). For example, a vector c of length n+1 corresponds to the following n-th order polynomial
compan (c)
conv (a, b)
y = conv (a, b)
returns a vector of length equal to
length (a) + length (b) - 1
.
If a and b are polynomial coefficient vectors, conv
returns the coefficients of the product polynomial.
deconv (y, a)
[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 remander polynomial of lowest order.
poly (a)
poly (a)
is the row vector of the coefficients of det (z * eye (n) - a)
,
the characteristic polynomial of a. If x is a vector,
poly (x)
is a vector of coefficients of the polynomial
whose roots are the elements of x.
polyderiv (c)
polyinteg (c)
polyreduce (c)
polyval (c, x)
polyval (c, x)
will evaluate the polynomial at the
specified value of x.
If x is a vector or matrix, the polynomial is evaluated at each of
the elements of x.
polyvalm (c, x)
polyvalm (c, x)
will evaluate the polynomial in the
matrix sense, i.e. matrix multiplication is used instead of element by
element multiplication as is used in polyval.
The argument x must be a square matrix.
residue (b, a, tol)
residue
returns r, p, k, and
e, where the vector r contains the residue terms, p
contains the pole values, k contains the coefficients of a direct
polynomial term (if it exists) and e is a vector containing the
powers of the denominators in the partial fraction terms.
Assuming b and a represent polynomials
we have:
where M is the number of poles (the length of the r,
p, and e vectors) and N is the length of the k
vector.
The argument tol is optional, and if not specified, a default
value of 0.001 is assumed. The tolerance value is used to determine
whether poles with small imaginary components are declared real. It is
also used to determine if two poles are distinct. If the ratio of the
imaginary part of a pole to the real part is less than tol, the
imaginary part is discarded. If two poles are farther apart than
tol they are distinct. For example,
Example:
b = [1, 1, 1]; a = [1, -5, 8, -4]; [r, p, k, e] = residue (b, a)returns
r = [-2, 7, 3] p = [2, 2, 1] k = [](0x0) e = [1, 2, 1]which implies the following partial fraction expansion
roots (v)