Modal response and frequency shift of the cantilever in a noncontact atomic force microscope