I'm getting different results when calling numpy.polyfit and matlab polyfit functions on exemplary set of data:
Python3.2:
(Pdb) a_array = [1, 2, 4, 6, 8,7, 9]
(Pdb) numpy.polyfit( range (len (a_array)), a_array, 1)
array([ 1.35714286, 1.21428571])
Matlab:
a_array = [1, 2, 4, 6, 8,7, 9]
polyfit(1:1:length(a_array), a_array, 1)
ans =
1.3571 -0.1429
This is obviously not a numerical error.
I assume that the default value of some special option (like ddof in std function) differs between Python and matlab but I can't find it. Or maybe I should use another version of Python's polyfit?
How can I get the same polyfit results in both, Python Numpy and Matlab?