用 gnuplot 拟合指数趋势线数据

用 gnuplot 拟合指数趋势线数据

我正在尝试将指数趋势线拟合到以下数据,其图形如下所示: 在此处输入图片描述

使用以下代码作为趋势线:

\addplot+[raw gnuplot, red, mark=none, smooth] gnuplot {
    f(x)=a*exp(b*x+c)-0.06002;
    % let gnuplot fit, using column 1 and 2 of the data file
    % using the following initial guesses
    a=1000;
    b=-59571;
    c=0.005;
    set datafile separator ",";
     fit [0.005:] f(x) 'GE020.dat' using 1:2 via a,b,c;
         % Next, plot the function and specify plot range
         % The range should be approx. the same as the test.dat x range
     plot [x=0.00494:0.00515] f(x);
    set print "parameters.dat"; % Open a file to save the parameters into
};
\addlegendentry[]{\pgfplotstableread{parameters.dat}\parameters % Open the file Gnuplot wrote
    \pgfplotstablegetelem{0}{0}\of\parameters \pgfmathsetmacro\paramA{\pgfplotsretval} % Get first element, save into \paramA
     $y=\pgfmathprintnumber{\paramA} \cdot x$  
}

但我收到了错误:

Package pgfplots Warning: the current plot has no coordinates (or all have been filtered away)

我期望输出: 在此处输入图片描述

相关内容