32A.3 Control Systems Toolbox

Back

There are several toolboxes with MATLAB, which can be used to analyze, compute, simulate, and design

control problems. Both time-domain representations and frequency-domain representations can be

TABLE 32A.6 Useful Matrix Functions in MATLAB

Function Description

det() Determinant

inv() Inverse

eig() Eigenvalues

[,] ¼ eig() Eigenvectors and eigenvalues

TABLE 32A.5 Some Matrix Operations in MATLAB

Operation Description

þ Addition

2 Subtraction

p Multiplication

/ Division

^ Power

‘ Transpose

Vibration Design and Control 32-77

© 2005 by Taylor & Francis Group, LLC

used. Also, both classical and modern control problems can be handled. The application is illustrated

here through several control problems.

32A.3.1 MATLAB Modern Control Examples

Several examples in modern control engineering are given now to illustrate the use of MATLAB in

control.

32A.3.1.1 Pole Placement of a Third-Order Plant

A mechanical plant is given by the input–output differential equation fflx þ x€ ¼ u; where u is the input

and x is the output. Determine a feedback law that will yield approximately a simple oscillator with a

damped natural frequency of 1 unit and a damping ratio of 1=

ffiffi

2 p :

To solve this problem, first we define the state variables as x1 ¼ x; x2 ¼ x_1; and x3 ¼ x_2: The

corresponding state-space model is

x_ ¼

x_1

x_2

x_3

2

664

3

775

¼

0 1 0

0 0 1

0 0 21

􀀒 􀀓

|fflfflfflffl{zfflfflfflffl}

A

x1

x2

x3

2

664

3

775

þ

0

0

1

􀀒 􀀓

|{z}

B

u

y ¼ ½1 0 0 |fflffl{zfflffl}􀀉 Cx

The open-loop poles and zeros are obtained using the following MATLAB commands:

>> A ¼ ½ 0 1 0; 0 0 1; 0 0 2 1 􀀉;

>> B ¼ ½ 0; 0; 1 􀀉;

>> C ¼ ½1 0 0 􀀉;

>> D ¼ [0];

>> sys_open ¼ ss(A,B,C,D);

>> [nat_freq_open,damping_open,poles_open] ¼ damp(sys_open)

>> pzmap(sys_open)

The open-loop poles are: ½0 0 2 1􀀉T:

The step response of the open-loop system is obtained using the command:

>> step(sys_open)

FIGURE 32A.2 (a) Step response of the open-loop system; (b) step response of the third-order system with poleplacement

control.

Step Response

0 2 4 6 8 10

0

5

10

15

20

25

30

35

40

45

Amplitude

Step Response

0 2 4 6

0

0.01

0.02

0.03

0.04

0.05

0.06

Amplitude

32-78 Vibration and Shock Handbook

© 2005 by Taylor & Francis Group, LLC

The result is shown in Figure 32A.2(a). Clearly, the system is unstable.

With the desired damped natural frequency vd ¼ 1 and damping ratio z ¼ 1=

ffiffi

2 p ; we get the

undamped natural frequency vn ¼

ffiffi

2 p and, hence, zvn ¼ 1: It follows that we need to place two poles at

21 ^ j: Also the third pole has to be far from these two on the left half plane (LHP); say, at 210: The

corresponding control gain K can be computed using the “place” command in MATLAB:

>> p ¼ [2 1 þ j 2 1 2 j 2 10];

>> K ¼ place(A,B,p)

place:ndigits ¼ 15

K ¼

20:0000 22:0000 11:0000

The corresponding step response of the closed-loop system is shown in Figure 32A.2(b).

32A.3.1.2 Linear Quadratic Regulator for a Third-Order Plant

For the third-order plant in the previous example, we design a linear quadratic regulator (LQR), which

has a state feedback controller, using MATLAB Control Systems Toolbox. The MATLAB command

K ¼ lqr(A,B,Q,R) computes the optimal gain matrix K such that the state-feedback law u ¼ 2 Kx

minimizes the quadratic cost function

J ¼

ð1

0 ðxTQx þ uTRuÞdt

The weighting matrices Q and R are chosen to apply the desired weights to the various states and inputs.

The MATLAB commands for designing the controller are

>> A ¼ ½ 0 1 0; 0 0 1; 0 0 2 1 􀀉;

>> B ¼ ½ 0; 0; 1 􀀉;

>> C ¼ ½ 1 0 0 􀀉;

>> D ¼ [0];

>> Q ¼ ½ 2 0 0; 0 2 0; 0 0 2 􀀉;

>> R ¼ 2;

>> Klqr ¼ lqr(A,B,Q,R)

>> lqr_closed ¼ ss(A2BpKlqr,B,C,D);

>> step(lqr_closed)

The step response of the system with the designed

LQR controller is shown in Figure 32A.3.

32A.3.1.3 Modal Analysis Example

Consider the two-DoF mechanical system

shown in Figure 32A.4. We now solve the modal

analysis problem using MATLAB, for the numerical

values

a ¼ 0:5; b ¼ 0:5; m ¼ 1 kg; k ¼ 1 N=m

For the given mass matrix M and the stiffness

matrix K, the solution steps for the alternative

approach of modal analysis are

1. Determine M1=2 and M21=2:

2. Solve for the eigenvalues l and the

eigenvectors f of M21=2KM21=2: These

eigenvalues are the squares of the natural

frequencies of the original system.

Step Response

0 2 4 6 8

0

0.2

0.4

0.6

0.8

1

1.2

1.4

Amplitude

FIGURE 32A.3 Step response of the third-order

system with LQR control.

βk

am

k

m

Mass1 Mass 2

FIGURE 32A.4 A two-DoF system.

Vibration Design and Control 32-79

© 2005 by Taylor & Francis Group, LLC

3. Determine the modal vectors c of the original system using the transformation c ¼ M21=2f:

The program code is given below:

%Modal Analysis Example

clear;

m ¼ 1.0;

k ¼ 1.0;

M ¼ ½ m 0; 0 m=2 􀀉;

K ¼ ½3=2 p k 2 k=2;

2 k=2 k=2􀀉;

M_sqrt ¼ M^0.5;

M_s_inv ¼ inv(M_sqrt);

lemda ¼ eig(M_s_inv p K p M_s_inv);

[U,D] ¼ eig(M_s_inv p K p M_s_inv);

V ¼ M_s_inv p U;

disp‘( Natural frequencies’)

fprintf‘( omega1 ¼ %10.3f%14.3f \n,’sqrt(lemda(2,1)));

fprintf‘( \n omega2 ¼ %10.3f%14.3f \n,’sqrt(lemda(1,1)));

fprintf‘( \n’)

fprintf‘( \nMode shapes \n’)

fprintf‘( First mode Second Mode \n’)

for i ¼ 1:2

fprintf‘(%10.3f%14.3f \n,’V(i,2)/V(1,2),V(i,1)/V(1,1));

end

The necessary results are obtained as shown below:

>> Natural frequencies

omega1 ¼ 1:414

omega2 ¼ 0:707

Mode Shapes

First Mode Second Mode

1.000 1.000

2 1.000 2.000

32-80 Vibration and Shock Handbook

© 2005 by Taylor & Francis Group, LLC