cd '' set datafile separator "," #plot "xrd_data.csv" u 1:2 skip 1 wp bg(x) = m * x + c gaussian(x) = A * exp(-((x - x0)**2) / (2 * sigma**2)) f(x) = bg(x) + gaussian(x) m = 0.5 c=150 A=1200 x0=38.2 sigma=0.15 fit [37.5:39.0] f(x) 'xrd_data.csv' using 1:2 via m, c, A, x0, sigma set xrange [37.5:39.0] set terminal pngcairo size 800,600 enhanced font 'Verdana,10' set output 'gnuplot_fit_result1.png' plot 'xrd_data.csv' using 1:2 with points title 'Experimental Data', f(x) with lines linewidth 2.5 linecolor rgb "red" title 'Optimized Fit Model' set output