Time-Dependent Detection of the Refractive Index Distribution of Nonlinear Optical Materials