%
k = 1; m1 = 1; m2 = 1;
agg = [0      0     1     0
      0      0     0     1
   -k/m1   k/m1    0     0
    k/m2  -k/m2    0     0];
bgg = [0 0 1/m1 0]'; cgg = [0 1 0 0]; dgg = 0;
lamg = eig(agg);
[ta1,ta2,ta3,ta4] = bilin(agg,bgg,cgg,dgg,1,'Sft_jw',[-12 -2]);
lamtg = eig(ta1);
xaxis = 2:0.2:12;
[tmp1,tmp2]=size(xaxis);
y = sqrt(25-(xaxis-7*ones(tmp1,tmp2)).^2);
y = [y;-y];
subplot(111);
plot(xaxis,y,'--',-xaxis,y,'--',real(lamg),imag(lamg),'x',...
real(lamtg),imag(lamtg),'+',-real(lamtg),imag(lamtg),'*',...
-2*real(lamtg),imag(lamtg),'o')
text(0.2,0.35,'1) x -- original poles','sc')
text(0.2,0.3,'2) + -- shifted poles','sc')
text(0.2,0.25,'3) * -- H-Inf closed-loop poles in s~-plane','sc')
text(0.2,0.20,'4) o -- H-Inf closed-loop poles in s-plane','sc')
text(-3,0,'p1')
text(3,0,'-p1')
text(-13,0,'p2')
text(13,0,'-p2')
xlabel('(p1 = -2, p2 = -12)')
grid
title('Example of Bilinear Mapping: s~ = (-s + p1) / (s/p2 -1)')
pause
