Insert x-value to polyfit vector to get y-value (Matlab) -


i used matlab command polyfit interpolate curve. wanted calculate y-max value of curve. have found roots polynomial, have x-value want insert in polynomial polyfit y-value x-value.

i have difficulties working properly.

p polynomial, know, p(1)^4, p(2)^3... , on

p = [-1.99405270507682e+26  5.55362828633395e+24    -5.80027044841956e+22   2.69238494640005e+20    -4.68659390860982e+17] 

the x-value want insert y-value

x = 7.765633479578490e-04

the y-value should 17.7. thinking right here? x-value correct, have compared plot.

thanks in advance guys!

something wrong in calculations. values give in question, p(x) enormous due enormous polynomial coefficients have:

p =    -1.9941e+026  5.5536e+024  -5.8003e+022  2.6924e+020  -4.6866e+017  >> x = 7.765633479578490e-04 x =   7.7656e-004 >> y = polyval(p,x) y =  -2.9203e+017 

these roots of polynomial, have small imaginary parts, given enormous coefficients of polynomial, cannot neglected:

>> format long g >> roots(p)  ans =          0.00696463336211033 +  9.88579484856405e-07i         0.00696463336211033 -  9.88579484856405e-07i         0.00696084682252702 +  1.06977927834625e-06i         0.00696084682252702 -  1.06977927834625e-06i 

Comments