This paper presented a simple,accurate,and fast method to synthesize the physical parameters of fiber Bragg grating numerically from FBG reflection spectrum. The method is based on the transfer matrix method and a Multi-subgroup competition genetic algorithm. The novel method was applied to design the structure parameters of uniform FBG for filtering,and chirped FBG for dispersion compensation. The analysis curve of the gratings shows a good agreement with the expected curve,and the algorithm is better than the calssical evolutionary programming algorithm in the aspects of global optimization and convergence.