使用 Math.Net 数值,如何找到 "Power" 的曲线拟合
Using Math.Net Numerics, how to find a curve fitting for "Power"
我正在尝试在 Excel 中重现相同的曲线拟合(称为 "trending"),但在 C# 中:指数、线性、对数、多项式和幂。
我发现线性和多项式为:
Tuple<double, double> line = Fit.Line(xdata, ydata);
double[] poly2 = Fit.Polynomial(xdata, ydata, 2);
我也找到了Exponential fit。
但是我想知道如何对Power进行曲线拟合。有人有想法吗?
我应该能够得到两个常量,如 Excel 屏幕截图公式所示:
- 功率
- 乘数(x 前)
在任何人成为第五个投票结束此问题的人之前...
我直接在mathdotnet(我最近发现的)的论坛上问了这个问题。该库的主要开发人员 Christoph Ruegg 回答了我一些非常好的问题,我想分享这些内容以帮助其他人解决同样的问题:
Assuming with power you’re referring to a target function along the
lines of y : x -> a*x^b, then this is a simpler version of what I’ve
described in Linearizing non-linear models by transformation.
This seems to be used often enough so I’ve started to add a new
Fit.Power and Fit.Exponential locally for this case - not pushed yet
since it first needs more testing, but I expect it to be part of v4.1.
Alternatively, by now we also support non-linear optimization which
could also be used for use cases like this (FindMinimum module).
Link 我的问题:mathdonet - Curve fitting: Power
我正在尝试在 Excel 中重现相同的曲线拟合(称为 "trending"),但在 C# 中:指数、线性、对数、多项式和幂。
我发现线性和多项式为:
Tuple<double, double> line = Fit.Line(xdata, ydata);
double[] poly2 = Fit.Polynomial(xdata, ydata, 2);
我也找到了Exponential fit。
但是我想知道如何对Power进行曲线拟合。有人有想法吗?
我应该能够得到两个常量,如 Excel 屏幕截图公式所示:
- 功率
- 乘数(x 前)
在任何人成为第五个投票结束此问题的人之前...
我直接在mathdotnet(我最近发现的)的论坛上问了这个问题。该库的主要开发人员 Christoph Ruegg 回答了我一些非常好的问题,我想分享这些内容以帮助其他人解决同样的问题:
Assuming with power you’re referring to a target function along the lines of y : x -> a*x^b, then this is a simpler version of what I’ve described in Linearizing non-linear models by transformation.
This seems to be used often enough so I’ve started to add a new Fit.Power and Fit.Exponential locally for this case - not pushed yet since it first needs more testing, but I expect it to be part of v4.1.
Alternatively, by now we also support non-linear optimization which could also be used for use cases like this (FindMinimum module).
Link 我的问题:mathdonet - Curve fitting: Power