matlabs polyfit not working correctly problem
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
i have a vector called "mean_vec" which consists of 81 values of " -0.1175 -0.1181 "-0.1175 -0.1194 -0.1197 -0.1195 -0.1205 -0.1214 -0.1215 ...etc.."
i made a polyfit to it using T_vec with polifit
p = polyfit(T_vec,mean_vec,3);
vector p (the coefficents of the polinomial) are:
0.0000 -0.0009 0.3100 -33.8948
so i tried to recreate my "mean_vec" using a polinomial
pol=-0.0009.*(T_vec).^2+0.31.*T_vec-33.8948
But i get "pol" to have value atronomickly higher then "mean_vec"
where as if i do polyval(p,T_vec); i get almost the exact vector i had before.
where did i go wrong?
Thanks
0 commentaires
Réponse acceptée
James Tursa
le 7 Avr 2020
Modifié(e) : James Tursa
le 7 Avr 2020
Highest order is first in the p vector. So explicitly this would be
pol = p(1)*T_vec.^3 + p(2)*T_vec.^2 + p(3)*T_Vec + p(4)
You might be missing exponents on the numbers you used? Double check the displayed output of the polyfit( ) result. There might be an exponent printed right above the p values.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Descriptive Statistics dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!