# HG changeset patch # User jwe # Date 1127424699 0 # Node ID 9d0aab486882abb62e24d3f92c35f3e4484c7cfe # Parent ab7973a599cfac56718907910aeb756866457a80 [project @ 2005-09-22 21:31:39 by jwe] diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,12 @@ +2005-09-22 John W. Eaton + + * polynomial/residue.m: Use logical indexing instead of find.. + +2005-09-22 Julius Smith + + * polynomial/residue.m: Avoid division by zero for pure imaginary + and zero poles. + 2005-09-22 Bill Denney * strings/deblank.m: Handle cell arrays. diff --git a/scripts/polynomial/residue.m b/scripts/polynomial/residue.m --- 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.