Why is polyfit giving me "NAN"
Show older comments
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 Comments
dpb
on 30 Jun 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
on 30 Jun 2016
Do you possibly have duplicate x ?
Image Analyst
on 30 Jun 2016
Does x or y have 0, or negative numbers, or nan's in them?
Samuel Vergara
on 30 Jun 2016
I think you have zeros in X or Y. so log(0)=-inf. Try with cftool.
Regards.
Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!