;----define the gamma distribution function gamma_fit, shape, slope, N0, r return, N0*r^shape*exp(-slope*r)/gamma(shape+1) end ; ;----------------fitting---------------- ;provide an initial guess of the functions parameters initial=[7,1,1.e8] weights=0 x=FLOAT(INDGEN(10)) y=[12.0, 11.0, 10.2, 9.4, 8.7, 8.1, 7.5, 6.9, 6.5, 6.1] yfit = CURVEFIT(x, y, weights, initial, SIGMA, FUNCTION_NAME='gamma_fit') END