In a spectrophotometer, what is the primary function of the monochromator — such as a prism or diffraction grating?