mpoles.m function doesn't handle correctly [0 0] or any all-zero vector
Ben Abbott
bpabbott at mac.com
Wed Jun 17 18:05:38 CDT 2009
On Jun 17, 2009, at 12:09 AM, daniel at alacer.com.br wrote:
> To: bug at octave.org
> Cc: daniel at alacer.com.br
>
> Subject: mpoles.m function doesn't handle correctly [0 0] or any all-
> zero vector
> --------
> Bug report for Octave 3.2.0 configured for i386-apple-darwin8.11.1
>
> Description:
> -----------
>
> When trying to use residue for a denominator like [1 0 0], or [1 0 0
> 0]
> , or any polynomial that has all the poles zeroes, octave will keep
> printing
> the message "warning: division by zero" and will never show the
> result.
> For example:
> num=[1]
> den=[1 0 0]
> [r p k e]=residue(num,den)
>
> I could find that the problem happens when residue calls the
> function mpoles.
> So, the real problem is that mpoles.m doesn't handle correctly a all
> zeroed
> root list.
>
> Repeat-By:
> ---------
>
> Two ways of seeing the problem:
>
> num=[1]
> den=[1 0 0]
> [r p k e] = residue (num,den)
>
> or
>
> den=[1 0 0]
> p=roots(den)
> [e, indx] = mpoles ( p )
>
> Fix:
> ---
>
> I could fix this problem editing the file mpoles.m
>
> I substituted the following lines:
>
> p0 = mean (abs (p(find (abs (p) > 0))));
> if (isempty (p0))
> p0 = 1;
> endif
>
> By:
> p0=find (abs (p) > 0);
> if (isempty (p0))
> p0 = 1;
> else
> p0 = mean (abs (p(p0)));
> if (isempty (p0))
> p0 = 1;
> endif
> endif
>
> I think this change will not cause any problem with the normal
> behavior of the function, but
> will solve the problem.
>
Daniel,
If you'll provide me with your last name, I'll list you as the
contributer to the changeset I've prepared.
Ben
More information about the Bug-octave
mailing list