A simple, accurate, and fast method to synthesize the physical parameters of a fiber Bragg grating numerically from its reflectivity is proposed and demonstrated. Our program uses the transfer matrix method and is based on a Nelder-Mead simplex optimization algorithm. It can be applied to both uniform and nonuniform (apodized and chirped) fiber Bragg gratings. The method is then used to synthesize a uniform Bragg grating from its reflectivity taken at different temperatures. It gives a good estimate of the thermal expansion coefficient and the thermo-optic coefficient of the fiber.