diff scripts/polynomial/residue.m @ 904:3470f1e25a79

[project @ 1994-11-09 21:22:15 by jwe]
author jwe
date Wed, 09 Nov 1994 21:22:15 +0000
parents 4e826edfbc56
children f558749713f1
line wrap: on
line diff
--- a/scripts/polynomial/residue.m
+++ b/scripts/polynomial/residue.m
@@ -1,46 +1,47 @@
 function [r, p, k, e] = residue(b,a,toler)
-#[r p k e] = residue(b,a)
-#If b and a are vectors of polynomial coefficients, then residue
-#calculates the partial fraction expansion corresponding to the
-#ratio of the two polynomials. 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 P(s) and Q(s) we have:
+
+# [r p k e] = residue(b,a)
+# If b and a are vectors of polynomial coefficients, then residue
+# calculates the partial fraction expansion corresponding to the
+# ratio of the two polynomials. 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 P(s) and Q(s) we have:
 #
-# P(s)    M       r(m)         N
-# ---- =  #  -------------  +  # k(n)*s^(N-n)
-# Q(s)   m=1 (s-p(m))^e(m)    n=1
+#  P(s)    M       r(m)         N
+#  ---- =  #  -------------  +  # k(n)*s^(N-n)
+#  Q(s)   m=1 (s-p(m))^e(m)    n=1
 #
-#(# represents summation) 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.
+# (# represents summation) 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.
 #
-#[r p k e] = residue(b,a,tol)
-#This form of the function call may be used to set a tolerance value.
-#The default value is 0.001. 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.
+# [r p k e] = residue(b,a,tol)
+# This form of the function call may be used to set a tolerance value.
+# The default value is 0.001. 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.
 #
-#Example:
-# b = [1 1 1];
-# a = [1  -5   8  -4];
+# Example:
+#  b = [1 1 1];
+#  a = [1  -5   8  -4];
 #
-# [r p k e] = residue(b,a)
+#  [r p k e] = residue(b,a)
 #
-# returns
+#  returns
 #
-# r = [-2 7 3]; p = [2 2 1]; k = []; e = [1 2 1];
+#  r = [-2 7 3]; p = [2 2 1]; k = []; e = [1 2 1];
 #
-# which implies the following partial fraction expansion
+#  which implies 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)
+#        s^2 + s + 1         -2       7        3
+#    ------------------- = ----- + ------- + -----
+#    s^3 - 5s^2 + 8s - 4   (s-2)   (s-2)^2   (s-1)
 #
-#SEE ALSO: poly, roots, conv, deconv, polyval, polyderiv, polyinteg
+# SEE ALSO: poly, roots, conv, deconv, polyval, polyderiv, polyinteg
 
 # Author:
 #  Tony Richardson
@@ -50,7 +51,7 @@
 # Here's the method used to find the residues.
 # The partial fraction expansion can be written as:
 #
-#          
+#
 #   P(s)    D   M(k)      A(k,m)
 #   ---- =  #    #    -------------
 #   Q(s)   k=1  m=1   (s - pr(k))^m
@@ -109,7 +110,7 @@
 # We then solve for the residues using matrix division.
 
   if(nargin < 2 || nargin > 3)
-    error("usage: residue(b,a[,toler])");
+    usage ("residue(b,a[,toler])");
   endif
 
   if (nargin == 2)