多项式方程参数 [英] polynomial equation parameters

查看:124
本文介绍了多项式方程参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些2D采样点需要多项式方程式.我只发现了这样的东西:

I have some 2D sampling points for which I need the polynomial equation. I only found something like this:

from scipy.interpolate import barycentric_interpolate
// x and y are given as lists
yi = barycentric_interpolate(x, y, xi)

但是在这种情况下,我只能得到属于某些xi值的y值-这不是我想要的.我需要方程式(多项式方程式的参数).我怎么能收到呢?

But in this case I can only get the y-values belonging to certain xi-values - that's not what I want. I need the equation (the parameter for the polynomial equation). How can I receive this?

推荐答案

拟合多项式p(x)= p [0] * x ** deg + ... + p°度deg 点(x,y).返回系数p的向量,该向量使 平方误差.

Fit a polynomial p(x) = p[0] * x**deg + ... + p[deg] of degree deg to points (x, y). Returns a vector of coefficients p that minimises the squared error.

文档示例:

>>> x = np.array([0.0, 1.0, 2.0, 3.0,  4.0,  5.0])
>>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0])
>>> z = np.polyfit(x, y, 3)
>>> z
array([ 0.08703704, -0.81349206,  1.69312169, -0.03968254])

这篇关于多项式方程参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆