与 Matlab 函数 : Polyfit/Polyval? 等效的 Javascript 函数

标签 javascript math matlab linear-algebra

迫切需要一个与 Matlab 中存在的 polyval 和 polyfit 函数等效的 Javascript。本质上,matlab 中的那些函数根据指定的多项式基于两个大小相等的数组进行曲线拟合。我需要在 javascript 中进行一些涉及曲线拟合的计算,但我一辈子都找不到等效的函数。

这是MatLab对函数polyfit的解释

"P = POLYFIT(X,Y,N) finds the coefficients of a polynomial P(X) of degree N that fits the data Y best in a least-squares sense. P is a row vector of length N+1 containing the polynomial coefficients in descending powers, P(1)*X^N + P(2)*X^(N-1) +...+ P(N)*X + P(N+1)."

这是MatLab对polyval的解释

"POLYVAL Evaluate polynomial. Y = POLYVAL(P,X) returns the value of a polynomial P evaluated at X. P is a vector of length N+1 whose elements are the coefficients of the polynomial in descending powers.

    Y = P(1)*X^N + P(2)*X^(N-1) + ... + P(N)*X + P(N+1)"

任何帮助都会很棒。

问候,

最佳答案

numericjs可能会帮助您入门。

关于与 Matlab 函数 : Polyfit/Polyval? 等效的 Javascript 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6826522/

相关文章:

javascript - 检查输入值长度

javascript - 如何使用reduce正确链接promise

list - 使用每组的一个数字查找多组中的数字总和

复共轭转置matlab到C

performance - 没有 for 循环的求和 - MATLAB

c++ - 为 matlab R2011b 设置 c++ 编译器

javascript - 将图像作为 Prop 传递时无法加载图像

javascript - 点击按钮的 Google 脚本用户 ID

algorithm - 计算旋转矩形中的最大内接矩形

javascript - 我如何完成这个百分比问题