Mercurial > hg > octave-nkf
comparison scripts/polynomial/residue.m @ 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 | 2618a0750ae6 |
comparison
equal
deleted
inserted
replaced
5463:ab7973a599cf | 5464:9d0aab486882 |
---|---|
203 ## Find the poles. | 203 ## Find the poles. |
204 | 204 |
205 p = roots (a); | 205 p = roots (a); |
206 lp = length (p); | 206 lp = length (p); |
207 | 207 |
208 | |
209 ## Determine if the poles are (effectively) zero. | 208 ## Determine if the poles are (effectively) zero. |
210 index = find (abs (p) < toler); | 209 |
211 if (length (index) != 0) | 210 p(abs (p) < toler) = 0; |
212 p (index) = 0; | |
213 endif | |
214 | 211 |
215 ## Determine if the poles are (effectively) real. | 212 ## Determine if the poles are (effectively) real. |
216 | 213 |
217 index = find (abs(p)>=toler && ( abs(imag(p)) ./ abs(p) < toler )); | 214 index = (abs (p) >= toler && (abs (imag (p)) ./ abs (p) < toler)); |
218 if (length (index) != 0) | 215 p(index) = real (p(index)); |
219 p (index) = real (p (index)); | |
220 endif | |
221 | 216 |
222 ## Find the direct term if there is one. | 217 ## Find the direct term if there is one. |
223 | 218 |
224 if (lb >= la) | 219 if (lb >= la) |
225 ## Also returns the reduced numerator. | 220 ## Also returns the reduced numerator. |