It is a general purpose algorithm to try different degrees of polynomial without having to change anything in the code except the degree of the polynomial
for more information on the functioning of polyfit consider reading the Official documentation
You can expect something like :