polyfit would work x=np.arange(0,4) y=np.array([0,1,1.9,3.1]) np.polyfit(x,y,1). Gives array([ 1.02, -0.03]). The two values are m and c where y = mx + c.
確定! 回上一頁