Está en la página 1de 48

NATIONAL CHENG KUNG UNIVERSITY

Department of Mechanical Engineering

ADAPTIVE CONTROL
HOMEWORK 5

Instructor:

Ming Shaung Ju

Student:

Nguyen Van Thanh

Student ID:

P96007019

Department:

Inst. of Manufacturing & Information Systems

Class:

1001- N164400 - Adaptive Control

November 25, 2011

Contents
Problem 1 ...................................................................................................................... 2
Problem 2 .................................................................................................................... 13
Problem 3 .................................................................................................................... 37

Adaptive Control Theory HW5

Page 1

Problem 1
Consider a process

Transfer function of the process:


() =

0 + 1
()
=
2 + 1 + 2 ()

Transfer function of the desired closed-loop system:

Where,

() =

0
()
=
2 + 1 + 2 ()
0 = 0.1761
1 = 1.3205
2 = 0.4966

A general linear controller:

() = () ()

Our job is to define three polynomials: R, S and T.

(a) Design a controller in which the stable zero of process model is canceled.
Step 1:
Adaptive Control Theory HW5

Page 2

We can see that


() = +

1
1
0.08118
1
= 0.6927
0 + = 0 = =
0.1172
0
0
0
|| =

1
<1
0

= + = +

0 0

1
+ = +

= 0

deg() = 2, deg() = 1

Let deg( ) = 2 deg() 1 = 2 2 1 = 3

deg() = deg( ) deg() = 3 2 = 1

deg() deg() , deg() = deg() 1 deg() = 1


deg(0 ) = deg() deg(+ ) 1 = 2 1 1 = 0

Choose 0 () = 1

= + , deg() = deg() = 1 deg( ) = 0 = 1

Step 2:

() = + () = +

1
= + 0.6927
0

The Diophantine equation:


+ = + + + = 0 + + = 0
Adaptive Control Theory HW5

Page 3

+ 0 =

(2 + 1 + 2 ) + 0 (0 + 1 ) = ( 2 + 1 + 2 )
2 + (1 + 0 0 ) + 2 + 0 1 = 2 + 1 + 2

By comparing coefficients of this equation, we obtain

1 1
= 1.0691
0

2 2
1 =
= 1.4556
0
0 =

Step 3:

=
= 0
0 +

= 0 = 0

The controller:

0
0

0
0

= 0
=1

0
= 1.5026
0

() = () ()

is thus characterized by the polynomials:

() = + 0.6927

() = 1.0691 1.4556
() = 1.5026

Plug these polynomials into the controller:

() = () ()

Adaptive Control Theory HW5

Page 4

( + 0.6927)() = 1.5026 () (1.0691 1.4556)()

(1 + 0.69271 )() = 1.5026 () (1.0691 1.45561 )()

() + 0.6927( 1) = 1.5026 () 1.0691() + 1.4556( 1)

() = 0.6927( 1) + 1.5026 () 1.0691() + 1.4556( 1)

(b) Design a controller in which no zero of process model is canceled. Choose a proper
delay d0.
Step 1:
No zero of process model is canceled = + = 1 deg(+ ) = 0
= = 0 + 1

=
= (deg( ) = deg() = 1)
=

Transfer function of the desired closed-loop system:


() =

0 + 1
()
=
2 + 1 + 2 ()

Parameter is chosen such that ( = 1) = 1 =

1+1 +2

deg() = 2, deg() = 1

0 +1

= 0.8877

Let deg( ) = 2 deg() 1 = 2 2 1 = 3

deg() = deg( ) deg() = 3 2 = 1

deg() deg() , deg() = deg() 1 deg() = 1


deg(0 ) = deg() deg(+ ) 1 = 2 0 1 = 1

Choose 0 () = + 0 (|0 | < 1)


Adaptive Control Theory HW5

Page 5

Poles of the closed-loop system:


() = 0 2 + 1 + 2 = 0

1 = 0.6603 + 0.2463
2 = 0.6603 0.2463

|1 | = |2 | = 0.7047
0.7047 |0 | < 1

Again, 0 () = + 0 (0.7047 |0 | < 1)

= + = 1 = = + 1 ( )
= 0 + 1

Step 2:
The Diophantine equation:

+ = + + + = 0 + + = 0

( 2 + 1 + 2 )( + 1 ) + (0 + 1 )(0 + 1 ) = ( + 0 )(2 + 1 + 2 )
3 + (1 + 1 + 0 0 ) 2 + (1 1 + 2 + 0 1 + 1 0 ) + (2 1 + 1 1 )
= 3 + (0 + 1 ) 2 + (2 + 1 0 ) + 2 0

By comparing coefficients of this equation, we obtain

1 + 1 + 0 0 = 0 + 1
1 1 + 2 + 0 1 + 1 0 = 2 + 1 0
2 1 + 1 1 = 2 0

1 + 0 0 = 0 1 + 1
1 1 + 1 0 + 0 1 = 2 + 2 + 1 0
2 1 + 1 1 = 2 0

Adaptive Control Theory HW5

Page 6

1 = 0.88020 + 0.0830
= 1.02220 + 0.3611
0
1 = 1.11690 0.6820
0.7047 |0 | < 1

Step 3:

() = 0 = ( + 0 ) = 0.8877 + 0.88770 (0.7047 |0 | < 1)

The controller:

() = () ()

is thus characterized by the polynomials:

() = + 1

() = 0 + 1

Where

() = ( + 0 ) = + 0
1 = 0.88020 + 0.0830
= 1.0222 + 0.3611
0
0
1 = 1.11690 0.6820

0.7047 |0 | < 1

= 0.8877

Plug these polynomials into the controller:

() = () ()

( + 1 )() = ( + 0 ) () (0 + 1 )()

(1 + 1 1 )() = ( + 0 1 ) () (0 + 1 1 )()

() + 1 ( 1) = () + 0 ( 1) 0 () 1 ( 1)
Adaptive Control Theory HW5

Page 7

() = 1 ( 1) + () + 0 ( 1) 0 () 1 ( 1)

(c) Simulate above designs when command is a square wave of amplitude 1 and period
of 25 sampling periods. Test the effect of step disturbance on the tracking
performance. You may try step with different magnitude. (for simulating let a0 = 0.8)
1
Out1
Disturbance

Clock

MATLAB
Function

t0.z

b0.z+b1

z+r1

z2 +a1.z+a2

Command

T/R

B/A

Cmd & Opt

s0.z+s1
z+r1
S/R

Figure 1. Block diagram of sys with stable cancellation

Figure 2. Command & output, with stable zero cancellation

Adaptive Control Theory HW5

Page 8

Figure 3. Command & output, with stable zero cancellation, and step disturbance

Figure 4. Command & output, with no zero cancellation

Adaptive Control Theory HW5

Page 9

Figure 5. Command & output, with no zero cancellation, and step disturbance
(d) Compare the tracking performance, ringing of input and disturbance rejection of the
two designs. Discuss on the effect of time delay on the performance of the adaptive
controller. Plot y(t), uc(t) vs. t and u(t), e(t) vs. t.
Plot y(t), uc(t): we can see through Fig. 2 to Fig. 5. Two controllers have very same
performance (tracking and disturbance).
Discuss on the effect of time delay on the performance of the adaptive controller: we
should choose the time delay as small as possible. When the time delay is large that
means the output signal lags phase to the command signal. Hence, the performance of
the system is not good.
From Fig. 6 and Fig.8, the control input signal with stable zero cancellation design has a
severe oscillation (ringing) compare to that of no zero cancellation design

Adaptive Control Theory HW5

Page 10

Figure 6. Control input signal with stable zero cancellation design

Figure 7. Error between uc(t) and y(t), with stable zero cancellation design
Adaptive Control Theory HW5

Page 11

Figure 8. Control input signal with no zero cancellation design

Figure 9. Error between uc(t) and y(t), with no zero cancellation design
Adaptive Control Theory HW5

Page 12

Problem 2
Consider a process

(a) Design an indirect STR in which the stable zero of process model is canceled.
Transfer function of the process:
() =

()
0 + 1
=
2 + 1 + 2 ()

Where, parameters {a1, a2, b0, b1} are unknown constants.


Transfer function of the desired closed-loop system:

Where,

() =

0
()
=
2 + 1 + 2 ()
0 = 0.1761
1 = 1.3205
2 = 0.4966

A general linear controller:

() = () ()
Adaptive Control Theory HW5

Page 13

Step 1: Estimate the coefficients of the polynomials A and B i.e. {a1, a2, b0, b1}, by
using the RLS:
() = 1 ( 1) 2 ( 2) + 0 ( 1) + 1 ( 2) = ( 1)
( 1) = [( 1) ( 2) ( 1) ( 2)]
= [1

The RLS with exponential forgetting is given by

1 ]

() = ( 1) + ()()

() = () ( 1)( 1)

() = ( 1)( 1) + ( 1)( 1)( 1)


Step 2:

() = ( () ( 1))( 1)/

With the stable zero of process model is canceled (this step for only define the degree of
the polynomials)
() = +

1
1
1
0 + = 0 =
0
0
0

|| =

1
< 1 |1 | < |0 |
0

= + = +

0 0

1
+ = +

= 0

Adaptive Control Theory HW5

Page 14

deg() = 2, deg() = 1

Let deg( ) = 2 deg() 1 = 2 2 1 = 3

deg() = deg( ) deg() = 3 2 = 1

deg() deg() , deg() = deg() 1 deg() = 1


deg(0 ) = deg() deg(+ ) 1 = 2 1 1 = 0

Choose 0 () = 1

= + , deg() = deg() = 1 deg( ) = 0 = 1


() = + () = +

The Diophantine equation:

1
= + 1
0

+ = + + + = 0 + + = 0
+ 0 =

(2 + 1 + 2 ) + 0 (0 + 1 ) = ( 2 + 1 + 2 )
2 + (1 + 0 0 ) + 2 + 0 1 = 2 + 1 + 2

By comparing coefficients of this equation, we obtain


1 1
0 =
0

2 2
1 =
0

=
= 0
+

Adaptive Control Theory HW5

Page 15

= 0 = 0

0
0

0
0

= 0
=1

0
= 0
0

() = + () = +

Step 3: Calculate the control law

1
= + 1
0

() = () ()

() + 1 ( 1) = 0 () 0 () 1 ( 1)

() = 1 ( 1) + 0 () 0 () 1 ( 1)

Repeat steps 1, 2 and 3 at each sampling period.

(b) Design an indirect STR in which no zero of process model is canceled. Choose a
proper delay d0.
Step 1: Estimate the coefficients of the polynomials A and B i.e. {a1, a2, b0, b1}, by
using the RLS:
() = 1 ( 1) 2 ( 2) + 0 ( 1) + 1 ( 2) = ( 1)
( 1) = [( 1) ( 2) ( 1) ( 2)]
= [1

The RLS with exponential forgetting is given by

1 ]

() = ( 1) + ()()

() = () ( 1)( 1)
Adaptive Control Theory HW5

Page 16

() = ( 1)( 1) + ( 1)( 1)( 1)


Step 2:

() = ( () ( 1))( 1)/

No zero of process model is canceled = + = 1 deg(+ ) = 0


= = 0 + 1

=
= (deg( ) = deg() = 1)
=

Transfer function of the desired closed-loop system:


() =

0 + 1
()
=
2 + 1 + 2 ()

Parameter is chosen such that ( = 1) = 1 =

1+1 +2

deg() = 2, deg() = 1

0 +1

Let deg( ) = 2 deg() 1 = 2 2 1 = 3

deg() = deg( ) deg() = 3 2 = 1

deg() deg() , deg() = deg() 1 deg() = 1


deg(0 ) = deg() deg(+ ) 1 = 2 0 1 = 1

Choose 0 () = + 0 (|0 | < 1)


Poles of the closed-loop system:

() = 0 2 + 1 + 2 = 0

1 = 0.6603 + 0.2463
2 = 0.6603 0.2463

|1 | = |2 | = 0.7047

Adaptive Control Theory HW5

Page 17

0.7047 |0 | < 1

Again, 0 () = + 0 (0.7047 |0 | < 1)

= + = 1 = = + 1 ( )
= 0 + 1

The Diophantine equation:

+ = + + + = 0 + + = 0

( 2 + 1 + 2 )( + 1 ) + (0 + 1 )(0 + 1 ) = ( + 0 )(2 + 1 + 2 )
3 + (1 + 1 + 0 0 ) 2 + (1 1 + 2 + 0 1 + 1 0 ) + (2 1 + 1 1 )
= 3 + (0 + 1 ) 2 + (2 + 1 0 ) + 2 0

By comparing coefficients of this equation, we obtain

1 + 1 + 0 0 = 0 + 1
1 1 + 2 + 0 1 + 1 0 = 2 + 1 0
2 1 + 1 1 = 2 0

1 + 0 0 = 0 1 + 1
1 1 + 1 0 + 0 1 = 2 + 2 + 1 0
2 1 + 1 1 = 2 0
1
0

1
0.7047 |0 | < 1

Step 3:

() = 0 = ( + 0 ) (0.7047 |0 | < 1)

The controller:
() = () ()

Adaptive Control Theory HW5

Page 18

is thus characterized by the polynomials:


() = + 1

() = 0 + 1

() = ( + 0 ) = + 0

Plug these polynomials into the controller:

() = () ()

( + 1 )() = ( + 0 ) () (0 + 1 )()

(1 + 1 1 )() = ( + 0 1 ) () (0 + 1 1 )()

() + 1 ( 1) = () + 0 ( 1) 0 () 1 ( 1)

() = 1 ( 1) + () + 0 ( 1) 0 () 1 ( 1)

Repeat step 1, 2 and 3 at each sampling period.

(c) Simulate above designs using following process parameters [a1, a2, b0, b1] = [1.3735, 0.7006, 0.1231, 0.07712] and initial guess of above parameter vector [0, 0,
0.01, 0.2]. The command is a square wave of amplitude 1 and period of 25 sampling
periods. You may test the effect of disturbance on the tracking performance. Either
stochastic or deterministic disturbance can be used.
c.1. Stable zero cancellation:
From the true model, we can find the true R, S and T.
1 1
= 0.4305
0

2 2
1 =
= 1.6572
0
0 =

Adaptive Control Theory HW5

Page 19


= 0
=1

0
= 0 = 1.4305
0

() = + () = +

1
= + 1 = + 0.6265
0

() = 1 ( 1) + 0 () 0 () 1 ( 1)

() = 0.6265( 1) + 1.4305 () 0.4305() + 1.6572( 1)

A function is written in Matlab can solve this problem:

function [estmtd_theta,yhat,ue,e,re1,se0,se1,te0] =
adtvCtrolHw5_STR1(uc,u,y,lambda)

am1 = -1.3205; am2 = 0.4966;


bm0 = 0.1761;
numOfCoeffs = 4;

% number of coefficents

alpha = 100;
t = length(y);

j=1;
phi_1(:,j)=[0;u(1:t-1,j)];
phi_2(:,j)=[0;0;u(1:t-2,j)];
phi_3(:,j)=[0;-y(1:t-1,j)];
phi_4(:,j)=[0;0;-y(1:t-2,j)];
phi = [phi_1(:,j) phi_2(:,j) phi_3(:,j) phi_4(:,j)];

[M,N] = size(phi);
P = alpha*eye(N);

% initial condition for projection matrix

estmtd_theta(1,:) = [0.01 0.2 0 0]; % inital condition for [b0 b1 a1


a2]
yhat = zeros(1,t);

% estimated value

re1 = zeros(1,N);

Adaptive Control Theory HW5

Page 20

se0 = zeros(1,N);
se1 = zeros(1,N);
te0 = zeros(1,N);
% initial conditions for three polynomials
re1(1) = estmtd_theta(1,2)/estmtd_theta(1,1);
se0(1) = (am1 - estmtd_theta(1,3))/estmtd_theta(1,1);
se1(1) = (am2 - estmtd_theta(1,4))/estmtd_theta(1,1);
te0(1) = bm0/estmtd_theta(1,1);
e = zeros(1,t);
ue(1) = 0;

for i = 2:M-numOfCoeffs+1;
z = P*phi(i,:)';
K = z/(lambda + phi(i,:)*z);
yhat(i) = phi(i,:)*estmtd_theta(i-1,:).';
e(i) = y(i) - phi(i,:)*estmtd_theta(i-1,:).';
estmtd_theta(i,:) = estmtd_theta(i - 1,:) + e(i)*K.';
P = (P - K*z.')/lambda;
re1(i) = estmtd_theta(i,2)/estmtd_theta(i,1);
se0(i) = (am1 - estmtd_theta(i,3))/estmtd_theta(i,1);
se1(i) = (am2 - estmtd_theta(i,4))/estmtd_theta(i,1);
te0(i) = bm0/estmtd_theta(i,1);
ue(i) = - re1(i)*ue(i-1) + te0(i)*uc(i) - se0(i)*yhat(i) se1(i)*yhat(i-1);
end
end

Adaptive Control Theory HW5

Page 21

Figure 10. Output

Figure 11. Error between process output and estimated output

Adaptive Control Theory HW5

Page 22

Figure 12. Output with step disturbance

Figure 13. Error between process output and estimated output

Adaptive Control Theory HW5

Page 23

c.2. No zero cancellation:


0 () = + 0 (0.7047 |0 | < 1)

1 + 1 + 0 0 = 0 + 1
1 1 + 2 + 0 1 + 1 0 = 2 + 1 0
2 1 + 1 1 = 2 0

1 + 0 0 = 0 1 + 1
1 1 + 1 0 + 0 1 = 2 + 2 + 1 0
2 1 + 1 1 = 2 0

Controller:

() = 0 = ( + 0 ) ( = 0.8795, 0.7047 |0 | < 1)


() = () ()

() = 1 ( 1) + () + 0 ( 1) 0 () 1 ( 1)

A function in Matlab can solve this problem:

function [estmtd_theta,yhat,ue,e,re1,se0,se1,te0] =
adtvCtrolHw5_STR2(uc,u,y,lambda)

numOfCoeffs = 4;

% number of coefficents

beta = 0.8795;
a0 = 0.8;
am1 = -1.3205; am2 = 0.4966;

t = length(y);
j=1;
phi_1(:,j)=[0;u(1:t-1,j)];
phi_2(:,j)=[0;0;u(1:t-2,j)];
phi_3(:,j)=[0;-y(1:t-1,j)];
phi_4(:,j)=[0;0;-y(1:t-2,j)];

Adaptive Control Theory HW5

Page 24

phi = [phi_1(:,j) phi_2(:,j) phi_3(:,j) phi_4(:,j)];

[M,N] = size(phi);
alpha = 100;
P = alpha*eye(N);

% initial condition for projection matrix

estmtd_theta(1,:) = [0.01 0.2 0 0]; % inital condition for [b0 b1 a1


a2]
yhat = zeros(1,t);

% estimated value

re1 = zeros(1,N);
se0 = zeros(1,N);
se1 = zeros(1,N);
te0 = zeros(1,N);
te1 = zeros(1,N);
% initial conditions for three polynomials
re1(1) = estmtd_theta(1,2)/estmtd_theta(1,1) - ((estmtd_theta(1,2) a0*estmtd_theta(1,1))*(am2*estmtd_theta(1,1)^2 am1*estmtd_theta(1,1)*estmtd_theta(1,2) + estmtd_theta(1,2)^2))/...
(estmtd_theta(1,1)*(estmtd_theta(1,4)*estmtd_theta(1,1)^2 estmtd_theta(1,3)*estmtd_theta(1,1)*estmtd_theta(1,2) +
estmtd_theta(1,2)^2));
se0(1) = (estmtd_theta(1,1)*(a0*estmtd_theta(1,4) estmtd_theta(1,3)*estmtd_theta(1,4) - a0*am2 + estmtd_theta(1,4)*am1)
- estmtd_theta(1,2)*...
(estmtd_theta(1,4) - am2 + a0*estmtd_theta(1,3) - a0*am1 +
estmtd_theta(1,3)*am1 estmtd_theta(1,3)^2))/(estmtd_theta(1,4)*estmtd_theta(1,1)^2 estmtd_theta(1,3)*estmtd_theta(1,1)*estmtd_theta(1,2) +
estmtd_theta(1,2)^2);
se1(1) = (estmtd_theta(1,1)*(estmtd_theta(1,4)*am2 estmtd_theta(1,4)^2 - a0*estmtd_theta(1,3)*am2 +
a0*estmtd_theta(1,4)*am1)...
- estmtd_theta(1,2)*(a0*estmtd_theta(1,4) estmtd_theta(1,3)*estmtd_theta(1,4) - a0*am2 +

Adaptive Control Theory HW5

Page 25

estmtd_theta(1,4)*am1))/(estmtd_theta(1,4)*estmtd_theta(1,1)^2 estmtd_theta(1,3)*estmtd_theta(1,1)*estmtd_theta(1,2) +
estmtd_theta(1,2)^2);

te0(1) = beta;
te1(1) = beta*a0;
e = zeros(1,t);
ue(1) = 0;

for i = 2:M-numOfCoeffs+1;
z = P*phi(i,:)';
K = z/(lambda + phi(i,:)*z);
yhat(i) = phi(i,:)*estmtd_theta(i-1,:).';
e(i) = y(i) - phi(i,:)*estmtd_theta(i-1,:).';
estmtd_theta(i,:) = estmtd_theta(i - 1,:) + e(i)*K.';
P = (P - K*z.')/lambda;

re1(i) = estmtd_theta(i,2)/estmtd_theta(i,1) ((estmtd_theta(i,2) - a0*estmtd_theta(i,1))*(am2*estmtd_theta(i,1)^2


- am1*estmtd_theta(i,1)*estmtd_theta(i,2) + estmtd_theta(i,2)^2))/...
(estmtd_theta(i,1)*(estmtd_theta(i,4)*estmtd_theta(i,1)^2 estmtd_theta(i,3)*estmtd_theta(i,1)*estmtd_theta(i,2) +
estmtd_theta(i,2)^2));
se0(i) = (estmtd_theta(i,1)*(a0*estmtd_theta(i,4) estmtd_theta(i,3)*estmtd_theta(i,4) - a0*am2 + estmtd_theta(i,4)*am1)
- estmtd_theta(i,2)*...
(estmtd_theta(i,4) - am2 + a0*estmtd_theta(i,3) - a0*am1 +
estmtd_theta(i,3)*am1 estmtd_theta(i,3)^2))/(estmtd_theta(i,4)*estmtd_theta(i,1)^2 estmtd_theta(i,3)*estmtd_theta(i,1)*estmtd_theta(i,2) +
estmtd_theta(i,2)^2);

Adaptive Control Theory HW5

Page 26

se1(i) = (estmtd_theta(i,1)*(estmtd_theta(i,4)*am2 estmtd_theta(i,4)^2 - a0*estmtd_theta(i,3)*am2 +


a0*estmtd_theta(i,4)*am1)...
- estmtd_theta(i,2)*(a0*estmtd_theta(i,4) estmtd_theta(i,3)*estmtd_theta(i,4) - a0*am2 +
estmtd_theta(i,4)*am1))/(estmtd_theta(i,4)*estmtd_theta(i,1)^2 estmtd_theta(i,3)*estmtd_theta(i,1)*estmtd_theta(i,2) +
estmtd_theta(i,2)^2);

te0(i) = beta;
te1(i) = beta*a0;
ue(i) = - re1(i)*ue(i-1) + te0(i)*uc(i)+ te1(i)*uc(t-1) se0(i)*yhat(i) - se1(i)*yhat(i-1);
end
end

Figure 14. Output

Adaptive Control Theory HW5

Page 27

Figure 15. Error between process output and estimated output

Figure 16. Output with step disturbance

Adaptive Control Theory HW5

Page 28

Figure 17. Error between process output and estimated output with step disturbance
(d) Plot y and uc vs. t, u vs. t and estimated process parameters vs. t. Compare the
tracking performance, ringing of input and disturbance rejection of the two designs.
Discuss on the effect of time delay on the performance of the adaptive controller.
d.1. Stable zero cancellation:

Adaptive Control Theory HW5

Page 29

Figure 18. uc and y_estimated vs time

Figure 19. u (control input is computed from controller law) vs time

Adaptive Control Theory HW5

Page 30

Figure 20. Estimated process parameters

Adaptive Control Theory HW5

Page 31

Figure 21. uc and y_estimated vs time with step disturbance

Figure 22. u (control input is computed from controller law) vs time with step
disturbance
Adaptive Control Theory HW5

Page 32

Figure 23. Estimated process parameters


d.2. No zero cancellation:

Figure 24. uc and y_estimated vs time


Adaptive Control Theory HW5

Page 33

Figure 25. u (control input is computed from controller law) vs time

Figure 26. Estimated process parameters


Adaptive Control Theory HW5

Page 34

Figure 27. uc and y_estimated vs time with step disturbance

Figure 28. u (control input is computed from controller law) vs time with step
disturbance
Adaptive Control Theory HW5

Page 35

Figure 29. Estimated process parameters with step disturbance


From Fig. 19 and Fig.25, the control input signal with stable zero cancellation design
has a severe oscillation (ringing) compare to that of no zero cancellation design
Two controllers have very same performance (tracking and disturbance).
Discuss on the effect of time delay on the performance of the adaptive controller: we
should choose the time delay as small as possible. When the time delay is large that
means the output signal lags phase to the command signal. Hence, the performance of
the system is not good.

Adaptive Control Theory HW5

Page 36

Problem 3

Solution:
I will take only one case in P2: the stable zero of the process model is canceled
Matlab code:
clear all; close all; clc;

% define command signal


Ts = 0.5;
Tuc = 25*Ts;
fuc = 1/Tuc;
t = 0:Ts:100;
uc = square(2*pi*fuc*t);

w = 1; % frequency
% variations
delta_a1 = 0.13735;
delta_a2 = 0.07006;
delta_b0 = 0.01231;
delta_b1 = 0.007712;

Adaptive Control Theory HW5

Page 37

% define a1, a2, b0, b1


a1 = -1.3735 + delta_a1*sin(w*t);
a2 = 0.7006 + delta_a2*sin(w*t);
b0 = 0.1231 + delta_b0*sin(w*t);
b1 = 0.07712 + delta_b1*sin(w*t);

% parameters of the desired closed-loop system


am1 = -1.3205; am2 = 0.4966;
bm0 = 0.1761;

% Rq = q + r1
r1 = b1./b0;
% S(q) = s0*q + s1
s0 = (am1 - a1)./b0;
s1 = (am2 - a2)./b0;
% T(q) = t0*q
t0 = bm0./b0;

% define input u(t) and process output y(t)


u(1) = 0; u(2) = 0;
y(1) = 0; y(2) = 0;
n = length(t);
for i = 3:n
y(i) = -a1(i)*y(i-1) - a2(i)*y(i-2) + b0(i)*u(i-1) + b1(i)*u(i2);
u(i) = -r1(i)*u(i-1) + t0(i)*uc(i) - s0(i)*y(i) - s1(i)*y(i-1);
end;

% call function
lambda = 1;
[estmtd_theta,yhat,ue,e,re1,se0,se1,te0]...
= adtvCtrolHw5_STR1(uc',u',y',lambda);

Adaptive Control Theory HW5

Page 38

figure(1);
plot(t(1:198),y(1:198),t(1:198),yhat(1:198));
xlabel('Time, sec');
ylabel('Output');
legend('Process output', 'Estimated output');
figure(2);
plot(e); grid on;
xlabel('Time, sec');
ylabel('Error');
figure(3);
plot(t(1:198),uc(1:198),'--',t(1:198),yhat(1:198));
xlabel('Time, sec');
ylabel('uc(t) & y-estimated(t)');
legend('uc(t)', 'y-estimated(t)');
figure(4);
plot(ue);
xlabel('Time, sec');
ylabel('Control input signal');
figure(5);
plot(t(1:198),estmtd_theta(:,1),t(1:198),b0(1:198),'--',...
t(1:198),estmtd_theta(:,2),t(1:198),b1(1:198),'--',...
t(1:198),estmtd_theta(:,3),t(1:198),a1(1:198),'--',...
t(1:198),estmtd_theta(:,4),t(1:198),a2(1:198),'--');
grid on;
xlabel('Time, sec');
ylabel('Process parameters');
legend('b0-estimated','b0','b1-estimated','b1','a1estimated','a1',...
'a2-estimated','a2');

Adaptive Control Theory HW5

Page 39

Figure 30. Output (delta = 10% of true value, w = 1 rad/sec)

Figure 31. Error between process and estimated output (delta = 10% of true value, w =
1 rad/sec)
Adaptive Control Theory HW5

Page 40

Figure 32. Command signal and estimated output (delta = 10% of true value, w = 1
rad/sec)

Figure 33. Control input signal (delta = 10% of true value, w = 1 rad/sec)

Adaptive Control Theory HW5

Page 41

Figure 34. True and estimated parameters (delta = 10% of true value, w = 1 rad/sec)

Figure 35. Output (delta = 15% of true value, w = 2 rad/sec)


Adaptive Control Theory HW5

Page 42

Figure 36. Error between process and estimated output (delta = 15% of true value, w =
2 rad/sec)

Figure 37. Command signal and estimated output (delta = 15% of true value, w = 2
rad/sec)

Adaptive Control Theory HW5

Page 43

Figure 38. Control input signal (delta = 15% of true value, w = 2 rad/sec)

Figure 39. True and estimated parameters (delta = 15% of true value, w = 2 rad/sec)
Adaptive Control Theory HW5

Page 44

Figure 40. Output (delta = 10% of true value, w = 1 rad/sec, lambda = 0.98)

Figure 41. Error between process and estimated output (delta = 10% of true value, w =
1 rad/sec, lambda = 0.98)

Adaptive Control Theory HW5

Page 45

Figure 42. Command signal and estimated output (delta = 10% of true value, w = 1
rad/sec, lamda)

Figure 43. Control input signal (delta = 10% of true value, w = 1 rad/sec, lambda = 1)

Adaptive Control Theory HW5

Page 46

Figure 44. True and estimated parameters (delta = 10% of true value, w = 1 rad/sec,
lambda = 0.98)
From all of figures above, we can see, it is very similar between weighted and unweighted design in this case. Because, the process parameters change as a sine function.
When frequency and variation increase the performance of the system is not good, even
maybe not stable.

Adaptive Control Theory HW5

Page 47