This article explains control using MATLAB with images and videos, focusing particularly on state feedback control. The videos and related article links explaining MATLAB simulations are provided at the bottom.
The following article summarizes state feedback control:
>>Summary of Control Based on State Equations
- Basics of State Feedback Control
- Lyapunov's Stability Criterion
- Anti-Sway Control of Crane
- MATLAB Control Simulation Videos and Related Articles
Basics of State Feedback Control
The following link provides an mlx file for executing the basics of state feedback control. It also contains MATLAB m-files and HTML files with execution results.
Link to MATLAB Source
>>Hiroshi-Okajima/MATLAB_fandamental_control (MATLAB codes) (github.com)
stateeq.m, stateeq.mlx, stateeq.html
The execution content is as follows:
- Verification of controllability
- Verification of observability
- State feedback by pole placement
- State feedback by optimal regulator
In the MATLAB live script file (mlx), you can adjust poles or the weight R of the optimal regulator.
Execution Results
Here, we introduce the execution results of the above files. Assume the control object (A, B, C of the state equation) is given as follows:
A=[0 1 0;0 0 1;-2 -3 -1],B=[0;0;1],C=[2 1 1]
The result of applying an impulse input to this is shown here.
This control object is assumed as controllable and observable. Next, we show the results of pole placement. Since the order of the control object is 3, three poles were placed at [-10, -12, -20].
It can be seen that high responsiveness is achieved. Of course, the response will vary with pole placement, so please try various ones. Finally, I would like to show the results of the optimal regulator. The weight function was set to Q = 10 I (I is the identity matrix), and R = 5.
Lyapunov's Stability Criterion
From the link below, you can download lyapunov.mlx and experiment with Lyapunov's stability criterion.
Link to MATLAB Source
>>Hiroshi-Okajima/MATLAB_fandamental_control (MATLAB codes) (github.com)
The solution trajectory is determined depending on the control object (and also on initial conditions). However, by appropriately setting the Lyapunov function, the stability of the system can be determined. By setting the Lyapunov function so that the solution trajectory moves in the direction of monotonically decreasing contour lines, a graph like the following can be created. The vertical axis is the Lyapunov function value, and the plane is states x1 and x2.
What is projected into two dimensions is represented as follows:
In a stable system, searching for a Lyapunov function shows the solution trajectory converging to the origin, and it can be seen that the solution trajectory always moves toward smaller contour values.
Anti-Sway Control of Crane
The following link provides MATLAB files for the anti-sway control of a crane.
Link to MATLAB Source (Animation)
>>Hiroshi-Okajima/matlab-animation: Control Animation with MATLAB (github.com)
The following video demonstrates anti-sway control of a crane using state feedback.
Running the MATLAB animation code creates an mp4 file.
MATLAB Control Simulation Videos and Related Articles
The following are videos conducting control simulations in MATLAB.