Why is polyfit giving me "NAN"
Afficher commentaires plus anciens
Hello,
I am curious why polyfit is returning 'nan'. My data set is finite and positive. I am attempting to study a power function and use it for my data. so here is what I have:
p = polyfit(log(x), log(y), 1);
However, I keep getting:
p = [nan nan] The dimensions of x and y are 1 column and 2617 rows
Please help and thank you so much!!
4 commentaires
dpb
le 30 Juin 2016
Range issue w/ log, most likely?
What is min(log()) and max for x, y?
You can try the scaling option to see if helps the numerics...
W/o a dataset, tough to say much more than "that's what the data say", sorry.
Walter Roberson
le 30 Juin 2016
Do you possibly have duplicate x ?
Image Analyst
le 30 Juin 2016
Does x or y have 0, or negative numbers, or nan's in them?
Samuel Vergara
le 30 Juin 2016
I think you have zeros in X or Y. so log(0)=-inf. Try with cftool.
Regards.
Réponses (0)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!