changeset 5464:9d0aab486882

[project @ 2005-09-22 21:31:39 by jwe]
author jwe
date Thu, 22 Sep 2005 21:31:39 +0000
parents ab7973a599cf
children d6163c0effd5
files scripts/ChangeLog scripts/polynomial/residue.m
diffstat 2 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,12 @@
+2005-09-22  John W. Eaton  <jwe@octave.org>
+
+	* polynomial/residue.m: Use logical indexing instead of find..
+
+2005-09-22  Julius Smith  <jos@ccrma.stanford.edu>
+
+	* polynomial/residue.m: Avoid division by zero for pure imaginary
+	and zero poles.
+
 2005-09-22  Bill Denney  <denney@seas.upenn.edu>
 
 	* strings/deblank.m: Handle cell arrays.
--- a/scripts/polynomial/residue.m
+++ b/scripts/polynomial/residue.m
@@ -205,19 +205,14 @@
   p = roots (a);
   lp = length (p);
 
+  ## Determine if the poles are (effectively) zero.
 
-  ## Determine if the poles are (effectively) zero.
-  index = find (abs (p) < toler);
-  if (length (index) != 0)
-    p (index) = 0;
-  endif
+  p(abs (p) < toler) = 0;
 
   ## Determine if the poles are (effectively) real.
 
-  index = find (abs(p)>=toler && ( abs(imag(p)) ./ abs(p) < toler ));
-  if (length (index) != 0)
-    p (index) = real (p (index));
-  endif
+  index = (abs (p) >= toler && (abs (imag (p)) ./ abs (p) < toler));
+  p(index) = real (p(index));
 
   ## Find the direct term if there is one.