Gnuplot: How can I determine the maxima of a fit function in gnuplot?

I have a set of data data.txt which can be fit to a Gaussian function, f(x). I want to determine the coordinates of the point of maxima (peak) from both the data given and also from the fit function f(x). How can I achieve this in gnuplot?

If you want to find maxima from the fit function $$f(x)$$ there are different way:
• computational brutal make an array, with a suitable range, evaluate it with your $$f(x)$$ and find the max in the result array. With the same index you find also the $$x$$ coordinate. To find the max and minimun in the arrays you can use the stats command.
• math essentially keep the analytic form of your function $$f(x)$$ and study max e min with derivative. Here depends how you build the function $$f$$. For example with gnuplot fit command use a nonlinear least-squares (NLLS) Marquardt-Levenberg algorithm and with the keyword via you can indicate the parameter are to be adjusted. If you define $$f(x)$$ as a Gaussian you will obtain the various parameters and you can study it.