A grating pattern computed in this manner can serve as a matched filter to the optical spectrum of transmission or reflection, depending upon whether light is passing through or is reflected from a substance or tissue before reaching the spectrophotometer, respectively.