We use an optimization method to find the parameters of the membership functions of a fuzzy logic controller (FLC) in order to minimize the steady state error for linear systems. The genetic algorithm (GA) and particle swarm optimization (PSO), which are optimization methods, were used to find the optimal FLC. The obtained FLC achieves regulation of the output and stability of the closed-loop system. Simulation results, with the optimal FLC and implemented in Simulink, show the feasibility of the proposed approach.