A programmed computer analyzes data from a mass spectrometer. A spectrum corresponding to an unknown sample is perturbed in various ways, and each perturbed spectrum is compared with the spectrum of a known or reference substance. The perturbed spectrum having the highest correlation with the known spectrum, and which is also physically plausible, is considered to be the best fit. The method indicates in what specific ways the unknown sample differs from, or is similar to, the known substance.