Technical Solutions
Why does the MATLAB command poly(roots(b)) fail to always return the original vector 'b'?
Date Last Modified: Friday, June 26, 2009
| Solution ID: | 1-15ROS | |
| Product: | MATLAB | |
| Reported in Release: | No Release | |
| Platform: | All Platforms | |
| Operating System: | All OS |
Subject:
Why does the MATLAB command poly(roots(b)) fail to always return the original vector 'b'?
Problem Description:
Here is an example:
roots(poly(ones(1,6))
ans =
1.0034 + 0.0020i
1.0034 - 0.0020i
1.0000 + 0.0039i
1.0000 - 0.0039i
0.9966 + 0.0019i
0.9966 - 0.0019i
Solution:This problem is caused by a roundoff error which demonstrates a fundamental problem with the way computers deal with floating point numbers. For more information about the way computers represent floating point numbers (more precisely, ANSI/IEEE Standard 754, double precision, for Binary Floating-Point Arithmetic), there is an excellent "Cleve's Corner" article discussing this. You can find it at This textbook discusses in greater depth why this problem is numerically difficult to solve. |
Related Solutions:
|
|
Store

