Herbert,<br><br>It's just a TeX file which gnuplot generates via the code in the gnuplot environment. I've cleaned up the code below.<br><br><br>\documentclass[]{article}<br>%<br>\usepackage[miktex]{gnuplottex}<br>
\usepackage{pst-all}<br>\usepackage{pst-func}<br>\usepackage{pstricks-add}<br><br>\makeatletter<br>\long\gdef\gnuplotgraphicsinclude{{\input{fit.tex}}}<br>\def\PsEuler{2.71828182846}<br>\makeatother<br>%<br>\begin{document}<br>
\pagestyle{empty}<br>\pagenumbering{arabic}<br>\readdata[ignoreLines=1]{\NLdata}{nl.dat}<br>\begin{figure}<br>\begin{psgraph}[arrows=->,Dx=1,Dy=0.1,xsubticks=1,ysubticks=1](0,0)(0,-1)(6,1){4.5in}{4.5in}<br><br>\begin{gnuplot}<br>
set print 'fit.tex'<br>f(x)=a*exp(-b*x)*sin(c*x+d) <br>fit f(x) 'nl.dat' using 1:2 via a,b,c,d <br>text1=sprintf('\psplot[algebraic]{0}{6}{%.2f*(\PsEuler^(-%.2f*x))*sin(%.2f*x+%.2f)}',a,b,c,d)<br>print text1<br>
text2=sprintf('\rput[lb](3,0.4){$%.2f*exp(-%.2f*x)*sin(%.2f*x+%.2f)$}',a,b,c,d)<br>print text2<br>\end{gnuplot}<br><br>\immediate\write18{del fit.tex}<br>\listplot[plotstyle=dots]{\NLdata}<br>\rput[cb](3,0.9){Curve Fit using GNUplot as backend}<br>
\end{psgraph}<br>\end{figure}<br><br>\end{document}<br>