2012-12-18 52 views
1

我有一個多項式取決於x和MATLAB y,當我找到它的根源不同的x的精度,根在多項式有時替代並不是一個幾乎零值,問題是什麼?增加求多項式的根在MATLAB

+2

你在用MATLAB做根發現是什麼?請發佈展示您的問題的最小代碼段。 – dinkelk

+1

正如我所說,我的多項式依賴於兩個變量x和y。我掃描x並使用「sym2poly」函數查找係數,然後使用「根」函數來查找這些係數的根。 – user1907354

+2

@ user1907354 - 您的評論非常有幫助,但如果您使用小型代碼示例對其進行編輯,它將顯着**幫助您解決問題。 – Shai

回答

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.