In view of the jitter of mechanical-optical switch, based on the models of a common uniform cantilever beam and a uniform cantilever beam carrying a mass at the free end, the dynamic response of beam under impact is researched by mode superposition method. The research indicates the reasons causing the jitter of optical power. A method of structure optimization is proposed to avoid the jitter. Experimental results prove the effectiveness of this method.