【发布时间】:2021-06-20 06:43:26
【问题描述】:
我有一组 x 和 y 值,我使用 gsl_multifit_linear 函数将它们拟合到多项式上。我想使用 gnuplot 将最佳拟合曲线绘制到散点图上。现在,我只知道如何自己绘制点:
FILE *gnuplot = popen("gnuplot", "w");
fprintf(gnuplot, "plot '-'\n");
for (int i = 0; i < num_points; i++)
fprintf(gnuplot, "%g %g\n", xvals[i], yvals[i]);
printf(gnuplot, "e\n");
fflush(gnuplot);
【问题讨论】:
-
这看起来不像是编程问题。您正在寻找如何使用 gnuplot 的帮助。
-
写下你想要的 gnuplot 脚本。然后修改您的代码以模仿脚本。无论如何,不知道拟合多项式的参数,是度等,不可能给你更具体的答案/建议。