用numpy/scipy拟合的6度曲线 [英] 6th degree curve fitting with numpy/scipy
问题描述
对于使用6阶多项式插值非线性数据,我有一个非常具体的要求.我见过numpy/scipy例程(scipy.interpolate.InterpolatedUnivariateSpline),这些例程最多只能进行5级插值.
I have a very specific requirement for interpolating nonlinear data using a 6th degree polynomial. I've seen numpy/scipy routines (scipy.interpolate.InterpolatedUnivariateSpline) that allow interpolation only up to degree 5.
即使没有直接函数可以执行此操作,是否有办法在Python中复制Excel的LINEST线性回归算法? LINEST允许进行6度曲线拟合,但是我不想在任何东西上使用Excel,因为此计算是更大的Python脚本的一部分.
Even if there's no direct function to do this, is there a way to replicate Excel's LINEST linear regression algorithm in Python? LINEST allows 6th degree curve-fitting but I do NOT want to use Excel for anything as this calculation is part of a much larger Python script.
任何帮助将不胜感激!
推荐答案
使用numpys polyfit例程.
Use numpys polyfit routine.
http://docs.scipy. org/doc/numpy-1.3.x/reference/generation/numpy.polyfit.html
这篇关于用numpy/scipy拟合的6度曲线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!