Design of a fuzzy controller requires specification of both membership functions and decision rules. Specification of membership function for a fuzzy logic controller has been an important issue. The traditional way of selecting membership functions has been, in most cases, an ad hoc procedure. In this paper, an optimization algorithm based on simulated annealing for designing a fuzzy membership function for fuzzy controllers is introduced. An optimization algorithm for designing the membership functions and fuzzy rule base for a fuzzy controller is presented. To demonstrate the method, a fuzzy controller for the truck backup problem is designed and implemented using this procedure.