Commit 674268ff authored by Adwait Datar's avatar Adwait Datar
Browse files

Gitlab Runner Update from orc-aux-files/master:Add code for for 15_1, 15_3 and 15_4

parent d1544a2b
% ORC 15.3 :: H2 norm computation
%
% TUHH :: Institut for Control Systems :: Optimal and Robust Control
% Last update: 20.05.2009
load orc15_design2 CL2 Gyr2
T = Gyr2;
%% Using the gramians
% with observability gramian
Wo = gram(T,'o');
h2gramo = sqrt( trace(T.B'* Wo *T.B) )
% with the controllability gramian
Wc = gram(T,'c');
h2gramc = sqrt( trace(T.C* Wc *T.C') )
%% Using the inpulse response
T_step = 0.001;
t = 0:T_step:2;
[g,t] = impulse(T,t);
Sum = 0;
for i = 1:length(t)
X(:,:) = g(i,:,:);
Sum = Sum + trace(X'*X);
end
h2imp = sqrt ( Sum * T_step )
%% with the norm function
h2norm = norm(T, 2)
hinfnorm = norm(T, inf)
% ORC 15.4 :: H-infinity norm calculation
%
% TUHH :: Institut for Control Systems :: Optimal and Robust Control
% Last update: 24.05.2016
load orc15_design2 Gyr2
T = Gyr2;
[A,B,C,D] = ssdata(T);
%% Using iterations over gamma
eigtol = 1e-6;
% tic
for gamma = 5:-0.01:0
M = [A 1/gamma*B*B'
-1/gamma*C'*C -A'];
if min(abs(real(eig(M)))) < eigtol % check if the minimum real eig.
% value is close to the imag. axis
break
end
end
hinf_iter = gamma
% toc
%% Or using bisections over gamma
g_max = 100;
g_min = 0.01;
g_tol = 0.1;
eigtol = 1e-6;
% tic
while g_max - g_min > g_tol
figure(1); clf; sigma(T); hold on; line([1e-1, 1e4], 20*log10([g_max, g_max]), 'Color', [0.0 0.8 0.0]); line([1e-1, 1e4], 20*log10([g_min, g_min]), 'Color', [0.8 0.0 0.0]);
pause;
gamma = (g_max + g_min)/2;
M = [A 1/gamma*B*B'
-1/gamma*C'*C -A'];
if min(abs(real(eig(M)))) < eigtol
g_min = gamma; % there is imag. eigval. ==> Hinf > gamma
else
g_max = gamma; % there is no imag. eigenval ==> Hinf < gamma
end
end
hinf_bis = gamma
% toc
%% Using the singular value plot and the norm function
sigma(T);
dta = ginput(1);
hinf_sig = 10^(dta(2)/20) % convert from log scala
hinf_norm = norm(T, inf)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment