For command [r,p,k]=residue(b,a), how the roots (p) are generated

According to the help, the roots p are calculated through function roots(). However, recently I found for a=[1.0000 0+0.9653i 2.8060 0+2.7979i 2.1418 0+2.2475i 0.3057 0+0.3973i -0.0083] and b=1
The roots calculated by roots(yd) and [r,p,k]=residue(1,a) are different. Specifically the result are listed as below:
By roots(a) The result are 0 - 1.1297i 0 - 1.1290i 0 - 0.9190i 0 - 0.5324i 0 - 0.0213i 0 + 0.4856i 0 + 1.0217i 0 + 1.2589i
while if [r,p,k]=residue(b,a) is called instead, the result of p is given by 0 - 1.1293i 0 - 1.1293i 0 - 0.9190i 0 - 0.5324i 0 - 0.0213i 0 + 0.4856i 0 + 1.0217i 0 + 1.2589i
Note the first two roots are differed by a small amount.
However, just because of this small amount, the calculation of r would deviate by a large value. Any explanation about this queer result?

Answers (2)

The result is the same, they are, just not sorted the same way.
[r,p,k]=residue(1,a)
p1=roots(a)
now compare
sort(p)-sort(p1)
I am geting the same values. I think residue(1,a) and roots(a) use the same function to calculate roots
the question is are you sur, you are using the same a? I am almost sur that one of the a is rounded

Asked:

on 22 Oct 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!