help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with consistency of root finding and sorting


From: Ben Abbott
Subject: Re: problem with consistency of root finding and sorting
Date: Wed, 10 Oct 2007 07:35:33 -0400


On Oct 10, 2007, at 3:45 AM, David Bateman wrote:

Ben Abbott wrote:

Thanks David,

another attempt, if you don't mind

p = roots([1 0 18 0 81])
p =

  -0.0000 + 3.0000i
  -0.0000 - 3.0000i
   0.0000 + 3.0000i
   0.0000 - 3.0000i

octave:1> p = roots([1 0 18 0 81])
p =

   0.0000 + 3.0000i
   0.0000 - 3.0000i
  -0.0000 + 3.0000i
  -0.0000 - 3.0000i

[e, indx] = mpoles (p)
e =

   1
   2
   1
   2

indx =

   1
   3
   2
   4

octave:2> [e, indx] = mpoles (p)
e =

   1
   2
   1
   2

indx =

   2
   4
   1
   3


p(indx)
ans =

  -0.0000 + 3.0000i
   0.0000 + 3.0000i
  -0.0000 - 3.0000i
   0.0000 - 3.0000i

octave:3> p(indx)
ans =

   0.0000 - 3.0000i
  -0.0000 - 3.0000i
   0.0000 + 3.0000i
  -0.0000 + 3.0000i


Thanks again. I believe I've found the bug ... and it is mine :-(

Using the attached mpoles.m, I get

p = roots([1 0 18 0 81])
p =

  -0.0000 + 3.0000i
  -0.0000 - 3.0000i
   0.0000 + 3.0000i
   0.0000 - 3.0000i

[e, indx] = mpoles(p)
e =

   1
   2
   1
   2

indx =

   1
   3
   2
   4

I assume you will get the same.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]