制御工学ブログ

制御工学の研究者を20年やっている国立大学教員が制御工学の基礎から専門まで広く説明します。記事内では、動画やMATLABコードを交えながらわかりやすく解説する方針です。制御工学チャンネル(YouTube,動画ポータル)を運営しています。

MATLAB Simulations of Control Engineering Topics

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

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.

>>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.

(Impulse Response) MATLAB Simulation

Impulse Response of Control Object

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].

MATLAB by Pole Placement

Pole Placement

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.

Optimal Regulator Calculation by MATLAB

Optimal Regulator

Lyapunov's Stability Criterion

From the link below, you can download lyapunov.mlx and experiment with Lyapunov's stability criterion.

>>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.

Lyapunov Function Value and MATLAB Simulation

Lyapunov (3D Plot)

What is projected into two dimensions is represented as follows:

Projection of Lyapunov Function Value by Simulation

Contour of Lyapunov Function (2D Plot)

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.

 

youtu.be

Anti-Sway Control of Crane

>>Hiroshi-Okajima/matlab-animation: Control Animation with MATLAB (github.com)

The following video demonstrates anti-sway control of a crane using state feedback.

youtu.be

Running the MATLAB animation code creates an mp4 file.

The following are videos conducting control simulations in MATLAB.

youtu.be

youtu.be

youtu.be