In the structured light 3 d optical measurement field, the sinusoidal grating design is one of the research focuses. The traditional focus methods of generating sine pattern is not widely accepted because of many well known defects. While another traditional binary pattern generated from Ronchi grating needs defocusing processing, its application has also been a certain limit because of its projected pattern contrast ratio is not high.In this paper, we have proposed a designing sine grating method with the spatial modulation theory based on Suboptimal PWM in electronic engineering. Compared with Ronchi grating, this method of generating pattern has a better fringe contrast, and more simple defocusing requirements, so this method has a good practical economic value.