gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:50:53 29 4
gpt4 key购买 nike

迫切需要一个与 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/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com