not a polynomial error

2 views (last 30 days)
Ajira
Ajira on 29 Oct 2019
Answered: Vedant Shah on 28 Apr 2025
Hey Guys,
I've a problem with using command SymNum. It returns :
Error using sym/sym2poly (line 30)
Not a polynomial.
Error in blaab (line 148)
TFnum = sym2poly(symNum);
I'm trying to return a eigenvalue to polynomial value in order to take frequency response from eigenvalues.
here are my two eigenvalues and I found a " ^(1/2) " or sqrt in my eigenvalues and I'm sure bc of sqrt I become this error but does anyone know how shoud I solve this problem??
d =
(1000*(300*(915166350000000000000000000000000000*s + 92091374302500000000000000000000000*s^2 + 4050759037830375000000000000000000*s^3 + 85294453297221250000000000000000*s^4 + 839426647542151875000000000000*s^5 + 3201446226471423890625000000*s^6 + 1160530083851214375000000*s^7 + 274295745577856250000*s^8 + 31391692074000000*s^9 + 2318919840000*s^10 + 78804495000000000000000000000*s^3*pi^2 + 8046264822750000000000000000*s^4*pi^2 + 152665574748412500000000000*s^5*pi^2 + 1038770004137420625000000*s^6*pi^2 + 2546901356286937500000*s^7*pi^2 - 3274156852736625625*s^8*pi^2 - 2383290277254600*s^9*pi^2 - 552158796114*s^10*pi^2 - 54962280*s^11*pi^2 - 2025*s^12*pi^2 + 3223820250000000000000000000000000000)^(1/2) - 50121000000000000000*s - 1276263150000000000*s^2 - 7471084987500000*s^3 + 31693412750000*s^4 + 10773802575*s^5 + 1832076*s^6 + 135*s^7 - 538650000000000000000))/(1013760000000000000000000*s + 21237684000000000000000*s^2 + 165999060600000000000*s^3 + 566102834000000000*s^4 + 204318183000000*s^5 + 48091927725*s^6 + 5496228*s^7 + 405*s^8 + 3950100000000000000*s^2*pi^2 + 43953030000000000*s^3*pi^2 + 192919277250000*s^4*pi^2 + 54962280000*s^5*pi^2 + 4050000*s^6*pi^2 + 15800400000000000000000000)
-(1000*(50121000000000000000*s + 300*(915166350000000000000000000000000000*s + 92091374302500000000000000000000000*s^2 + 4050759037830375000000000000000000*s^3 + 85294453297221250000000000000000*s^4 + 839426647542151875000000000000*s^5 + 3201446226471423890625000000*s^6 + 1160530083851214375000000*s^7 + 274295745577856250000*s^8 + 31391692074000000*s^9 + 2318919840000*s^10 + 78804495000000000000000000000*s^3*pi^2 + 8046264822750000000000000000*s^4*pi^2 + 152665574748412500000000000*s^5*pi^2 + 1038770004137420625000000*s^6*pi^2 + 2546901356286937500000*s^7*pi^2 - 3274156852736625625*s^8*pi^2 - 2383290277254600*s^9*pi^2 - 552158796114*s^10*pi^2 - 54962280*s^11*pi^2 - 2025*s^12*pi^2 + 3223820250000000000000000000000000000)^(1/2) + 1276263150000000000*s^2 + 7471084987500000*s^3 - 31693412750000*s^4 - 10773802575*s^5 - 1832076*s^6 - 135*s^7 + 538650000000000000000))/(1013760000000000000000000*s + 21237684000000000000000*s^2 + 165999060600000000000*s^3 + 566102834000000000*s^4 + 204318183000000*s^5 + 48091927725*s^6 + 5496228*s^7 + 405*s^8 + 3950100000000000000*s^2*pi^2 + 43953030000000000*s^3*pi^2 + 192919277250000*s^4*pi^2 + 54962280000*s^5*pi^2 + 4050000*s^6*pi^2 + 15800400000000000000000000)
thx.
  1 Comment
语桐 李
语桐 李 on 16 Jul 2021
Hello,I had the same problem, have you solved this problem? Thanks!

Sign in to comment.

Answers (1)

Vedant Shah
Vedant Shah on 28 Apr 2025
Hi @Ajira,
It is correct that when eigenvalues contain a square root term, the resulting expression is no longer a polynomial. Consequently, passing such an expression to the “sym2poly” function, which requires a polynomial input, will result in an error.
To obtain a polynomial form, the square root must be removed. This can typically be achieved by squaring both sides of the equation—when mathematically appropriate—or by approximating the square root using a Taylor expansion.
In this context, employing the “taylor” function is recommended to estimate the square root and thereby convert the equation into a polynomial form. It is advisable to apply the Taylor expansion separately to the numerator and denominator to preserve the rational structure of the transfer function.
The following steps can be followed to achieve desired results:
Extract the numerator & Denominator
[num, den] = numden(d);
Apply the ‘taylor’ function to both the expressions:
order = 6;
num_taylor = taylor(num, s, 'Order', order+1); % +1 because order is degree+1 in MATLAB
den_taylor = taylor(den, s, 'Order', order+1);
Convert the Taylor-expanded expressions to polynomial form:
TFnum = sym2poly(num_taylor);
TFden = sym2poly(den_taylor);
Obtain the final transfer function:
TFnum = TFnum/TFden;
For further information, please refer to the official documentation:

Categories

Find more on Functions in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!