将方程拟合到一组数据

phy*_*ysu 1 plotting math

我有一组数据:

1.12158 0.42563 0.07
1.12471 0.42112 0.07
1.12784 0.41685 0.07
1.13097 0.41283 0.07
1.13409 0.40907 0.07
1.13722 0.40556 0.07
1.14035 0.40231 0.07
1.14348 0.39933 0.07
1.1466 0.39661 0.07
1.14973 0.39417 0.07
1.15285 0.39201 0.07
1.15598 0.39012 0.07
1.15911 0.38852 0.07
1.16224 0.3872 0.07
1.16536 0.38618 0.07
1.16849 0.38544 0.07
1.17162 0.385 0.07
1.17474 0.38486 0.07
1.17787 0.38543 0.07
1.181 0.38714 0.07
1.18413 0.38994 0.07
1.18725 0.39378 0.07
1.19038 0.39858 0.07
1.19351 0.40426 0.07
1.19664 0.41071 0.07
1.19976 0.41786 0.07
Run Code Online (Sandbox Code Playgroud)

第一列是 x 轴,第二列是 y 轴。

我想将这些数据拟合到等式中:

Ax^2 + Bx + c
Run Code Online (Sandbox Code Playgroud)

并找出 A、B 和 c 的值。

我可以使用什么程序?

如果你能告诉我怎么做,我会很高兴。

谢谢。

Qua*_*odo 5

GNUPlot:CLI 解决方案

假设data.dat是包含数据的文件。

$ gnuplot
gnuplot> fit a*x**2 + b*x + c 'data.dat' via a, b, c
(...)
Final set of parameters            Asymptotic Standard Error
=======================            ==========================
a               = 22.2174          +/- 1.09         (4.906%)
b               = -51.7961         +/- 2.53         (4.885%)
c               = 30.5745          +/- 1.468        (4.802%)
(...)
Run Code Online (Sandbox Code Playgroud)

有关更多选项,请参阅文档中的适合部分

您也可以直接通过管道传输到 GNUPlot:

printf '%s\n' 'fit a*x**2 + b*x + c "data.dat" via a, b, c' | gnuplot
Run Code Online (Sandbox Code Playgroud)