“Modern Control Theory” is a specialized basic course for university automation majors and plays an important role in the undergraduate teaching of automation majors. It is also a basic course for postgraduate students such as “Linear system Theory” and “Optimal control theory”  . However, because the teaching content of modern control theory contains a large number of complex mathematical operations, the course content is more theoretical, more abstract concepts, students are not easy to understand, learning, feeling very difficult. According to the course characteristics of modern control theory, the design of modern control theory simulation experiment platform under Matlab environment can help students learn control theory. At present, many schools have studied and opened the course of “inverted pendulum control system”. The application of inverted pendulum control system in teaching has long attracted people’s attention, and it is recognized as a typical experimental equipment in modern control theory and a rare typical physical model in control theory teaching and scientific research  . Guilin University of Technology also introduced the linear two-stage inverted pendulum system of Shenzhen Gugao Company. Literature  introduces a self-developed first-level inverted pendulum teaching experiment system for small car models, which enables students to understand more about the control process of the electromechanical system of inverted pendulum from theory to practice. Based on Matlab/GUI design realization of inverted pendulum simulation experiment platform, integrate multiple simulation experiment platform does not need to move the actual inverted pendulum hardware, completely with the aid of computer and software operation, can be validated by the simulation experiment platform of abstract control theory and demonstration and solve our no teaching equipment in practical teaching and practical problems of the difficult to achieve.
2. The Development Environment
Hardware requirements: PC processors I3, I5, AMD Athlon or higher; At least 1GB of memory, recommended above 2 GB.
Software requirements: Microsoft Windows XP or Microsoft Windows 7; Matlab7.0 or Matlab R2013a.
Matlab is a software product developed by Math Works of the United States. It provides a good teaching tool for experimental teaching of modern control theory courses. The reason why the simulation experiment platform is designed and developed in Matlab environment is that the software has the following important characteristics  .
1) The software centralizes all the GUI supported User controls in GUIDE (Graphical User Interface Development Environment) and provides the User with a series of Graphical User Interface tools.
2) This software integrates rich and powerful toolbox functions, which are used to expand its symbolic calculation function, graphical modeling and simulation function, word processing function and real-time interaction with hardware function. It is very convenient for users to directly conduct high-level research without writing basic programs within the scope of their own disciplines.
3) The software has superior data processing ability, which can realize the inverted pendulum simulation platform to process the data and draw the curve, which is easier for students to understand the application of control theory.
4) Simulink is an integrated software package based on Matlab environment for dynamic system modeling, simulation and comprehensive analysis. On the GUI provided by Simulink, complex simulation models can be constructed by simply dragging and dropping the mouse. Moreover, by combining the external mode of Simulink with RTWT (real-time Windows Target), users can use Simulink model as GUI for signal visualization and module parameter adjustment  .
3. Design of Modern Control Theory Simulation Platform
3.1. Linear One-Stage Inverted Pendulum Mathematical Model
The main body of the linear inverted pendulum system includes pendulum rod, cart, portable bracket, guide rail, DC servo motor and so on. After ignoring the air resistance and various frictions, the linear one-stage inverted pendulum system can be abstracted into a system composed of trolley and homogenizing rod, as shown in Figure 1. In the analysis and design of the control system, the mathematical model of the controlled system should be established first, and the mathematical model of the linear one-stage inverted pendulum system should be established by using Newton-Euler method  . According to reference  , the parameters in Figure 1 are described in Table 1.
Figure 1. Schematic diagram of linear one-stage inverted pendulum model.
Table 1. Parameters of inverted pendulum system.
Assumed system state , the force on the trolley and pendulum rod was analyzed respectively, and the system state equation with the external force (u representing the input force F of the controlled object) as the input was obtained:
If you take the acceleration of the car as the input , the motion equation was established for the force analysis of the pendulum rod:
Then the system state equation with the acceleration of the trolley as the input is:
3.2. Design of Inverted Pendulum Experiment Platform
The software design part of the simulation experiment platform is mainly the offline simulation GUI design. In order to build an integrated operation interface for system modeling, parameter setting and simulation control, the GUI of the inverted pendulum experiment system was compiled under the GUIDE environment of Matlab. GUI design adopts object-oriented, event-driven programming technology, that is, through the master interface to call different experimental pages. For each experiment, the actions the GUI can implement include:
1) Each experiment is carried out in different steps. Set the step button to enter different experimental interfaces.
2) In the simulation experiment, the output response and state response are displayed in real time when the control parameters change. During the experiment, students can change the parameters of the controller by dragging the mouse or manually entering the controller. After the parameter modification, it takes effect immediately and is displayed on the GUI in the form of response curve.
3) The GUI can modify system parameters based on the recommended values for the inverted pendulum system parameters. Because with the use of the system, the equipment will have different degrees of wear, for parameters such as the coefficient of friction will be changed. Thus provide the interface in the GUI, students can easily adjust system parameters.
4) The platform sets aside interfaces. Students can input algorithm code according to Matlab grammar rules by editing window, or they can encapsulate their own S-function module and create their own algorithm module by applying s-function Builder to carry out open and design experiments.
3.3. Simulation Experiment of Modern Control Theory
3.3.1. Main Interface of the Simulation Experiment Platform
Type GUIDE in the command window of Matlab, select New in the pop-up dialog box, open the GUIDE interface or open the existing FIG screen. GUI design USES object-oriented, event-driven programming technology, users can control the program flow. In the design, a hierarchical structure is adopted, that is, different experimental pages are called through the main control interface. The main control interface of the simulation experiment platform is shown in Figure 2. Click an experimental item with the mouse and press the “run” button, or double-click the experimental item to switch to the corresponding experimental interface.
3.3.2. Specific Experimental Design
Take the “State space Pole assignment Control Experiment” as an example to illustrate, enter the experiment interface as shown in Figure 3, and click the operation steps of the experiment.
The main steps are as follows:
STEP1: Establish a system
Taking the inverted pendulum system as the controlled object, the mathematical model of the controlled object is established, such as formula (6) and (7), and the parameters are substituted into Table 1.
Figure 2. Main interface of modern control theory simulation experiment platform.
Figure 3. “State space Pole assignment Control” experimental project interface.
State space model of inverted pendulum:
Program code is as follows:
A=[0 1 0 0;0 0 0 0;0 0 0 1;0 0 48.3 0];
C=[1 0 0 0;0 0 1 0];
STEP2: Test system controllability
The system control matrix was established by applying “M=ctrb(A,B)”, and the system controllability was analyzed by rank(M). The rank N1 of the state controllability matrix of the system was equal to the state dimension of the system (4), and the rank N2 of the output controllability matrix of the system was equal to the dimension of the output vector of the system (2), indicating that the system was controllable.
Program code is as follows:
A=[0 1 0 0;0 0 0 0;0 0 0 1;0 0 48.3 0];
C=[1 0 0 0;0 0 1 0];
M1=[B A*B A^2*B A^3*B];
M2=[C*B C*A*B C*A^2*B C*A^3*B D];
STEP3: Calculate the eigenvalue
According to the requirements and with a certain margin (set the adjustment time as 2 seconds), the expected closed loop poles are calculated, and then the expected characteristic equation of the system and the original system characteristic equation are obtained.
The performance index of the system is made as follows by designing the controller:
1) Adjustment time: ;
2) Maximum overshoot: .
The expected closed-loop poles are calculated as follows:
1) Determine the position of the expected pole s of the closed loop, based on the maximum overshoot:
, get .
2) And by the , that is .
So the expected closed loop pole:
is the dominant pole, the other two poles are more than 5 times away from the imaginary axis.
So, select the desired closed-loop poles:
Therefore, the expected characteristic equation is as follows:
Result is: .
The characteristic equation of the original system is as follows:
STEP4: Calculate the gain matrix of state feedback
STEP5: simulation running
is applied to calculate the state feedback matrix. Under the initial state , run the prepared M file, and obtain the state response of the inverted pendulum state feedback closed-loop system. The simulation running results are shown in Figure 4. In the figure, “CartPos” is the position of the trolley, “CartSpd” is the speed of the trolley, “PendAng” is the Angle of the pendulum rod, and “PendSpd” is the angular speed of the pendulum rod. The Angle of the pendulum rod, the angular velocity of the pendulum rod and the speed of the trolley are all stable at 0, and the position of the trolley is stable at 0.01 m to the left of the origin, indicating that the designed controller can enable the inverted pendulum closed-loop control system to achieve the control goal of “the pendulum rod is vertically upward and the trolley is at the origin”.
Figure 4. Experimental results interface.
STEP6: Program code display
The program code interface to show this experiment is shown in Figure 5.
4. Teaching Practice of Modern Control Theory
The revised syllabus of modern Control Theory of Guilin University of Technology contains 38 theoretical periods and 10 experimental periods. The modern control theory simulation experiment platform developed based on MATLAB can not only solve the difficulty of insufficient hardware experimental equipment, but also facilitate the understanding of abstract and abstruse control theory and concepts for students to conduct independent and exploratory learning after class  .
4.1. Optimize the Experimental Teaching by Combining the Simulation Experiment Platform
In the experimental teaching, a linear one-stage inverted pendulum is taken as the controlled object, which is combined with the simulation experimental platform. Teachers rely on this simulation experimental platform for on-site demonstration and programming guidance. Students start from the mathematical modeling of the controlled object and master the whole process of how to design the control system according to the control task. For example, in the “Inverted pendulum pole assignment experiment”, the control problem with the control objective of “the pendulum rod is vertically upward and the car is at the origin” was studied. The students used the ctrb( ) function and rank( ) function of Matlab to obtain the controllability matrix of the system and judge the controllability of the system. The place( ) function was used to obtain the feedback matrix of the system pole assignment state. lsim( ) function is applied to compile the system
Figure 5. Experimental project code display interface.
state feedback M file, test the state response of the closed-loop system, observe the system state curve by running the program, compare the system output before and after the state feedback, and test the control performance of the designed state feedback controller. And the state feedback matrix is obtained by continuously allocating the hope poles, and the state response of the closed-loop system is tested until the output curve of the system reaches the optimal state. Through such a simulation test process, students can understand and master the theoretical relationship between the control performance index and pole position, as well as the implementation of pole assignment algorithm. By using the simulation experiment platform to realize the intuitive display of the state output of the control system, it is helpful for students to understand the principle, process and method of the state feedback controller design based on pole assignment, and facilitate students to verify relevant theories and methods in the experiment, so as to deepen their understanding of concepts, theories and methods. Combining the basic principles and basic knowledge learned in classroom teaching with the control of practical system not only deepens the understanding of book knowledge, but more importantly, cultivates students’ practical working ability.
4.2. Taking the Inverted Pendulum as the Research Object, Biochemical Theory Teaching
Because this course involves a lot of mathematical operations and abstract theoretical knowledge, students in our school have poor theoretical foundation, which leads to students’ difficulty in learning and lack of interest in traditional teaching. In order to solve the practical problems in teaching for many years, the teaching application of modern control theory is based on the experimental simulation platform of inverted pendulum. In classroom teaching, the inverted pendulum is taken as the application background. Through the understanding of the structure and principle of the inverted pendulum system, students can have a detailed understanding of the realization of a control system. From the concept of control system in theory to the concrete realization of control system, it changes the previous dogmatic mode and realizes the combination of theory and practice. It can intuitively show many abstract control concepts, such as system stability, controllability, system convergence speed and anti-interference ability, etc.    .
“Modern Control Theory” simulation experiment comprehensive platform takes the inverted pendulum control system as the research object, relies on Matlab powerful numerical calculation and digital simulation function, can complete the establishment of the control system model, analysis, comprehensive design, simulation research of the whole process. It meets the requirements of verification, openness, design and other different levels of experiments. Moreover, this platform can help students understand the relevant concepts, theories and methods in modern control theory, and learn scientific research methods in the specific research process to improve the ability to solve practical problems. From the concept of control system in theory to the concrete realization of control system, it changes the previous dogmatic mode and realizes the combination of theory and practice.
1) Guangxi higher education undergraduate teaching reform project (NO. 2020JGB201).
2) Undergraduate teaching construction project of Guilin University of Technology: Inverted pendulum, virtual simulation experiment teaching project.
 Brief Introduction to Matlab. http://www.fosu.edu.cn/li/math/SXRJ/Matlab/MatlabJIANJIE.htm
 Wang, Z.-M., Yao, H.-H. and Wang, J.-M. (2004) Research and Practice on Classroom Teaching and Individualized Training Model of Inverted Pendulum Control System. Higher Education Research, 20, 68-69.
 Li, J.S., Yan, G.Z., Feng, J.Z., et al. (2010) Establishment of Inverted Pendulum Experimental System Based on Linear Quadratic Optimal Control Strategy. Laboratory Research and Exploration, 29, 38-40, 60.