Calculation of the mean spectrum