How to cite a Matlab function
Since polyfit is a basic Matlab function, you could reference the Matlab Function Reference book (pdf) for the version of Matlab you are using. It would be appropriate to reference the page number of were the function is decsribed in your text. The manual is easily added as a book. The references can be found on the Mathworks web.