In this paper the dynamics of a single machine connected to infinite bus power system is analyzed. Such analysis requires a certain level of system modeling. The main system components models are the synchronous machine, excitation system and the Power System Stabilizer. The Matlab/Simulink is used as a programming tool to analyze the system performance. According to the system performance a proper design for the Power System Stabilizer (PSS) using Particle Swarm Optimization (PSO) is carried out. Then the designed PSS is implemented in the model and the dynamic system response is analyzed. Since the simulation results without the PSS showed unacceptable system response, the system response with the PSS has improved and the PSS succeeded to stabilize an unstable system.