MathTop

statistics_linear_fit 函数

使用最小二乘法对成对数值数据拟合直线。

语法

  • Statistics:-LinearFit([[x1, y1], ...], x)
  • Statistics:-LinearFit(xValues, yValues, x)

参数与选项

data点对 [[x1, y1], ...],或分别给出的 x 与 y 列表。
var变量名称。

示例

  1. 线性回归拟合Statistics:-LinearFit([[0, 1], [1, 3], [2, 5]], x)返回 2*x + 1。