'Polyfit issue with vector sizes even though size() function shows they're the same

I am receiving this error message, but I've printed the size of my two vectors and they're identical. I'm not sure what else could be causing it

error



Solution 1:[1]

The third argument to polyfit should be a number indicating the degree of the polynomial. You've given it a string, which is confusing it. If you want a linear fit, use polyfit(x, y, 1).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bg2b