简体   繁体   中英

Roots of a polynomial with great coefficients

I have a polynomial that has coefficients that depend on two parameters x and y and their powers non-linearly. I sweep x to find roots of the polynomial for y , but for most values of x, the function roots gives the error of "Input to ROOTS must not contain NaN or Inf", and when I see the coefficients of the polynomial with the sym2poly function, they are inf .

I can't change the polynomial because it is gained from a problem, what can I do?

For practical purposes I can suggest the following work around:

Replace all inf values by a really big positive number, and all -inf values by a big positive number.

For NaNs you can do something similar, but I think NaN is typically not used to replace a big number in Matlab. If you don't care about these points I guess you can just replace them by 0 for example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM