%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Section 3.7.1 Spinning satellite
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%State-space model (3.78)
a = 10;
A = [0  a; -a 0]; B = [1 0 ; 0 1]; C = [1 a; -a 1];  D = [0 0; 0 0];
G=pck(A,B,C,D);

w = logspace(-2,2,120);
Gf = frsp(G,w);
[U,sig,V] = vsvd(Gf);

%Figure 3.6 (a)
clf;
vplot('liv,lm',sig);
title('SINGULAR VALUES');
xlabel('Frequency [rad/s]');

I2 = eye(2);
K=I2;
% KG and GK are both equal to G
L = mmult(G,K);
S = minv(madd(I2,L));
T = msub(I2,S);
hinfnorm(S) % H-infinity norm of S is 10.05 (peak of singular value of S).
hinfnorm(T) % H-infinity norm of T is 10.05 (peak of singular value of T).

