Separate and simultaneous investigation of absorption gratings and refractive-index gratings by beam-coupling analysis