提高在matlab中找到多项式根的精度

时间:2012-12-18 06:20:24

标签: matlab

我有一个多项式取决于matlab中的xy,当我找到不同x的根时,有时多项式中根的替换不是几乎为零的值,问题是什么?

1 个答案:

答案 0 :(得分:1)

xy缩放不当时,可能会出现数值问题。例如,如果您的根(x,y)具有非常大的值,则机器精度可能会阻止您获得精确的根。尝试将您的函数扩展到(0,0)周围的紧凑域(通常[-1,1]x[-1,1]是一个很好的起点)。

%// let mx and my be upper bounds to |x| and |y| respectively
nx = x / mx; %// change of variables
ny = y / my;
%// express your polynom in nx and ny and solve for them
%// let nrx and nry be a root of the polynom in the new changed variables, then:
rx = nrx * mx; %// root in original varialbes
ry = nry * my;
%// if you want to verify that the roots indeed brings your polynom to zero, you should try it in the scaled domain with rnx, rny.