Lab 04 Experiment
Lab 04 Experiment
Please follow the instructions in the document and upload your pdf-files to the “uzak system”
NameSurnameLab1PreliminaryELE301LGuz23.pdf
NameSurnameNameSurnameLab1ExperimentELE301LGuz23.pdf
Important rules
The report format must be as the one that shared to you. If not point deduction will be
applied.
Contents
Problem 1 .................................................................................................................................................... 3
Task-1 ....................................................................................................................................................... 3
SOLUTION: ............................................................................................................................................ 3
Task-2 ....................................................................................................................................................... 5
SOLUTION ............................................................................................................................................. 5
Task-3 ....................................................................................................................................................... 6
SOLUTION ............................................................................................................................................. 6
Task-4 ....................................................................................................................................................... 7
SOLUTION ............................................................................................................................................. 7
Task-5 ....................................................................................................................................................... 8
SOLUTION ............................................................................................................................................. 8
Problem 2 .................................................................................................................................................. 11
Task-1 ..................................................................................................................................................... 11
Task-2 ..................................................................................................................................................... 11
Task-3 ..................................................................................................................................................... 11
Task-4 ..................................................................................................................................................... 12
Task-5 ..................................................................................................................................................... 12
Important Rules ........................................................................................................................................ 13
Problem 1
This is a demo-problem. Try to understand this problem and then solve the other problems after
that.
Task-1
For a given Plant transfer-function 𝑃(𝑠),
(𝑠 − 𝑝3 )
𝑃(𝑠) = , 𝑝 = 1, 𝑝2 = 1, 𝑝3 = 1
𝑠2 + 𝑝1 𝑠 − 𝑝2 1
SOLUTION:
To find 𝑃𝑎𝑢𝑔 (𝑠) system, the following matlab script is used.
Summer_1=sumblk('e=r-y');
P_aug =
connect(Plant,Summer_1,{'r','u'},{'e','u','e'})
zpk(P_aug)
From this one can obtain that the 𝑃𝑎𝑢𝑔 (𝑠) system is
−(𝑠 − 1)
1
(𝑠 + 1.618)(𝑠 − 0.618)
𝑃𝑎𝑢𝑔 (𝑠) = 0 1
−(𝑠 − 1)
1
[ (𝑠 + 1.618)(𝑠 − 0.618)]
𝑒
𝑤=𝑟 𝑧=[ ]
Notice the relation between the [ ] and [ 𝑢 ]
𝑢=𝑢
𝑦= [𝑒]
And
−(𝑠 − 1)
1
𝑤=𝑟 (𝑠 + 1.618)(𝑠 − 0.618) 𝑧 = [ 𝑒 ]
[ ]= 0 1 [ 𝑢 ]
𝑢=𝑢
−(𝑠 − 1) 𝑦 = [𝑒]
1
[ (𝑠 + 1.618)(𝑠 − 0.618)]
Where,
SOLUTION
The necessary matlab code to obtain the ℋ∞ controller is given as,
Summer_1=sumblk('e=r-y');
P_aug =
connect(Plant,Summer_1,{'r','u'},{'e','u','e'});
zpk(P_aug)
%%
% P_aug=[1,-Plant;0,1;1,-Plant];
% [K,CL,gamma] = hinfsyn(P,nmeas,ncont)
[K,CL,gamma] = hinfsyn(P_aug,1,1);
tf(K)
zpk(K)
As a result of this code-output, the CONTROLLER is obtained as,
−787.86(𝑠 + 1.618)
𝐾(𝑠) =
(𝑠 + 13.98)(𝑠 + 77.79)
Task-3
Find the 𝑇𝑧𝑤 (𝑠) transfer-function for the 𝐾(𝑠) (controller transfer function) that you obtained in
the previous task.
𝑇𝑧𝑤 (𝑠) is the transfer-function of the system between disturbance-inputs (w) to regulated-
outputs (z). 𝑇𝑧𝑤 (𝑠) expression is dependent on 𝐾(𝑠) and 𝑃𝑎𝑢𝑔 (𝑠) transfer-functions.
SOLUTION
To find 𝑇𝑧𝑤 (𝑠) we can directly use MATLAB. The following matlab code is used to find 𝑇𝑧𝑤 (𝑠).
Summer_1=sumblk('e=r-y');
P_aug =
connect(Plant,Summer_1,{'r','u'},{'e','u','e'});
zpk(P_aug)
P_aug.u={'w','u'}
P_aug.y={'z1','z2','y'}
%% Find K(s)
% P_aug=[1,-Plant;0,1;1,-Plant];
% [K,CL,gamma] = hinfsyn(P,nmeas,ncont)
[K,CL,gamma] = hinfsyn(P_aug,1,1);
K.u='y';
K.y='u';
% tf(K)
% zpk(K)
zpk(minreal(CL))
% sigma(CL)
%% Find Tzw(s)
Tzw=connect(P_aug,K,{'w'},{'z1','z2'})
zpk(Tzw)
zpk(minreal(Tzw))
𝛾 = min‖𝑇𝑧𝑤 (𝑠)‖ℋ∞
𝐾(𝑠)
Where, 𝑇𝑧𝑤 (𝑠) is the transfer function from disturbance-signals (w) to regulated-output (z). 𝛾
value is the “norm” of this transfer-function. If we can minimize 𝛾, that means we minimize the
norm of the transfer-function between disturbance signals to regulated-outputs. In other words,
if we can minimize 𝛾, we can minimize the effect of disturbance-inputs to the regulated-outputs.
SOLUTION
To find GAMMA we can directly use MATLAB. The following matlab code is used to find
GAMMA.
Summer_1=sumblk('e=r-y');
P_aug =
connect(Plant,Summer_1,{'r','u'},{'e','u','e'})
;
zpk(P_aug)
P_aug.u={'w','u'}
P_aug.y={'z1','z2','y'}
%% Find K(s)
% P_aug=[1,-Plant;0,1;1,-Plant];
% [K,CL,gamma] = hinfsyn(P,nmeas,ncont)
[K,CL,gamma] = hinfsyn(P_aug,1,1);
K.u='y';
K.y='u';
% tf(K)
% zpk(K)
zpk(minreal(CL))
% sigma(CL)
%% Find Tzw(s)
Tzw=connect(P_aug,K,{'w'},{'z1','z2'})
zpk(Tzw)
zpk(minreal(Tzw))
%% Find GAMMA
% [ninf,fpeak] = hinfnorm(sys,tol)
[GAMMA,fpeak] = hinfnorm(Tzw,1e-3)
As a result of the code-output, the GAMMA value is obtained as
𝛾 = 8.9950
Task-5
Test this controller for the parameter uncertainty case where the parameters take values
between given lower and upper limits. Find the corresponding GAMMA value for each
parameter combination and determine the worst (greatest) GAMMA value.
SOLUTION
For this problem, let us discretize the parameter range for each parameter and find GAMMA
values for each parameter combinations. For this the given Algorithm is used.
Display 𝛾𝑚𝑎𝑥
The necessary matlab code to solve this problem is the following,
Matlab code
clear all,close all,clc;
%% define the parameters
p1=1;
p2=1;
p3=1;
%% define the PLANT
Plant=tf([1,-p3],[1,p1,-p2]);
%% Find P-AUG(augmented)
Plant.u='u';
Plant.y='y';
Summer_1=sumblk('e=r-y');
P_aug = connect(Plant,Summer_1,{'r','u'},{'e','u','e'});
zpk(P_aug)
P_aug.u={'w','u'}
P_aug.y={'z1','z2','y'}
%% Find K(s)
% P_aug=[1,-Plant;0,1;1,-Plant];
% [K,CL,gamma] = hinfsyn(P,nmeas,ncont)
[K,CL,gamma] = hinfsyn(P_aug,1,1);
K.u='y';
K.y='u';
% tf(K)
% zpk(K)
zpk(minreal(CL))
% sigma(CL)
%% Find Tzw(s)
Tzw=connect(P_aug,K,{'w'},{'z1','z2'})
zpk(Tzw)
zpk(minreal(Tzw))
%% Find GAMMA
% [ninf,fpeak] = hinfnorm(sys,tol)
[GAMMA,fpeak] = hinfnorm(Tzw,1e-3)
%%
% p_range=[p_min,p_max]
p1_range=[p1-0.01,p1+0.01]
p2_range=[p2-0.01,p2+0.01]
p3_range=[p3-0.01,p3+0.01]
p1_vec=linspace(p1_range(1),p1_range(2),10);
p2_vec=linspace(p2_range(1),p2_range(2),10);
p3_vec=linspace(p3_range(1),p3_range(2),10);
max_Tzw_norm=0;
for i_1=1:1:length(p1_vec)
for i_2=1:1:length(p2_vec)
for i_3=1:1:length(p3_vec)
p1_temp=p1_vec(i_1);
p2_temp=p2_vec(i_2);
p3_temp=p3_vec(i_3);
% construct PLANT_temp
Plant_temp=tf([1,-p3_temp],[1,p1_temp,-p2_temp]);
% construct PAUG_temp
Plant_temp.u='u';
Plant_temp.y='y';
Summer_1=sumblk('e=r-y');
P_aug_temp = connect(Plant_temp,Summer_1,{'r','u'},{'e','u','e'});
P_aug_temp.u={'w','u'};
P_aug_temp.y={'z1','z2','y'};
% P_aug_temp=[1,-Plant_temp;0,1;1,-Plant_temp];
% construct Tzw_temp
Tzw_temp=connect(P_aug_temp,K,{'w'},{'z1','z2'});
% Tzw_temp=lft(P_aug_temp,K,1,1);
% compute "norm of Tzw_temp"
Tzw_norm_temp=hinfnorm(Tzw_temp);
if Tzw_norm_temp>max_Tzw_norm
disp([p1_temp,p2_temp,p3_temp,Tzw_norm_temp]);
if max_Tzw_norm==Inf
return;
end
end
max_Tzw_norm=max([max_Tzw_norm,Tzw_norm_temp]);
end
end
end
max_Tzw_norm
And the result is,
CONCLUSION:
For the “nominal plant”, we designed a
controller 𝐾(𝑠), and this controller resulted in
𝛾𝑛𝑜𝑚𝑖𝑛𝑎𝑙 = 8.9950 . however for the case
where the parameter take values from their
corresponding range meaning that have
upper and lower bounds, The same controller
𝐾(𝑠) resulted in 𝛾𝑚𝑎𝑥 = 10.3514 .
For each parameter combination we have
calculated the corresponding GAMMA value
and the worst-case is determined as
𝛾𝑚𝑎𝑥 = 10.3514
Problem 2
Task-1
For the given plant transfer-function 𝑃(𝑠),
(𝑠 + 𝑝3 )
𝑃(𝑠) = , 𝑝 = 1, 𝑝2 = 1, 𝑝3 = 1
𝑠2 + 𝑝1 𝑠 + 𝑝2 1
Task-2
Design an hinf controller. (hinf = h-infinity = ℋ∞ controller). Find 𝐾(𝑠) transfer-function.
Task-3
Find the 𝑇𝑧𝑤 (𝑠) transfer-function for the 𝐾(𝑠) (controller transfer function) that you obtained in
the previous task.
𝑇𝑧𝑤 (𝑠) is the transfer-function of the system between disturbance-inputs (w) to regulated-
outputs (z). 𝑇𝑧𝑤 (𝑠) expression is dependent on 𝐾(𝑠) and 𝑃𝑎𝑢𝑔 (𝑠) transfer-functions.
Task-4
Find GAMMA 𝛾. GAMMA value is the hinf-norm of the transfer-function 𝑇𝑧𝑤 (𝑠).
In other words,
𝛾 = ‖𝑇𝑧𝑤 (𝑠)‖ℋ∞
Task-5
Test this controller for the parameter uncertainty case where the parameters take values
between given lower and upper limits. Find the corresponding GAMMA value for each
parameter combination and determine the worst (greatest) GAMMA value.