倒立摆系统作为一种天然不稳定的系统,经常被用作验证控制方案是否可行的实验平台。在研究系统组成的基础上,建立了直线倒立摆系统的数学模型。在MATLAB的Simulink中,分别利用模块搭建的方法和编写S函数的方法,建立了直线倒立摆系统的线性和非线性模型,利用GUI完成PID控制器的设计。利用PID控制算法对直线倒立摆系统进行控制。仿真结果表明所用方法的可行性,为PID控制算法在倒立摆实验装置中的应用奠定了基础。 As a kind of natural unstable system, the inverted pendulum system is often used as a test platform to verify the feasibility of the control scheme. Based on the study of the system composition, the mathematical model of the linear inverted pendulum system is established. In Simulink MATLAB, the linear and nonlinear models of inverted pendulum system are established by using the method of module construction and the method of writing S function. And the PID controller is designed by using GUI. Inverted pendulum system is controlled based on PID control algorithm. The simulation results show the feasibility of the method, which lays the foundation for the application of the PID control algorithm in the inverted pendulum experiment equipment.