This paper presents a numerical approach to the model of a diffraction grating. The proposed method is based on the pulse-train approximation of the Dirichlet function and the effect of this approximation on the grating model. The model presented in this paper simplifies the expression of the physical properties of the grating and shows that the effect of grating is independent of the wavelength of the light passing through the device.