function ue_9show(G,K)
%ue_9show(G,K) berechnet den geschlossenen Kreis 
%         aus Strecke G und Regler K
%         und gibt die Simulationsergebnise aus.
%
% CAD-Uebung zur Vorlesung Entwurf Robuster Regelungen
% Thema: Entwurf H2- bzw. Hinf-Regler

% M. Grobe  11/1998, 01/2006
% Technische Universitaet Braunschweig, IfR

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%     Geschlossenen Kreis berechnen      Eingaenge: Fuehrung w, Stoerung z
%%%                                Ausgaenge: Stellgroesse u, Regelgroesse y
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp(' ')
disp('Geschlossener Kreis wird Simuliert ...')
disp('--------------------------------------')
systemnames='K G';
inputvar='[w;z]';
outputvar='[K;G+z;-w+G+z]';
input_to_G='[K]';
input_to_K='[-w+G+z]';
sysoutname='CL';
cleanupsysic='yes';
sysic

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%     Simulation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[y,t]=step(CL); % Fuehrung: y(1-3)
                % Stoerung: y(4-6)  
                % Stellgroesse: 1,4; Regelgroesse: 2,5; Fehler: 3,6

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%     Ausgabe
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(1)
subplot(3,1,1), plot(t,y(:,5))
ylabel('Regelgroesse')
title('Stoerung')
subplot(3,1,2), plot(t,y(:,4))
ylabel('Stellgroesse')
subplot(3,1,3), plot(t,y(:,6))  
ylabel('Fehler')
xlabel('Zeit in Sek.')

figure(2)
subplot(3,1,1), plot(t,y(:,2))
ylabel('Regelgroesse')
title('Fuehrung')
subplot(3,1,2), plot(t,y(:,1))
ylabel('Stellgroesse')
subplot(3,1,3), plot(t,y(:,3))  
ylabel('Fehler')
xlabel('Zeit in Sek.')

figure(3)
step(G,1)
title('ungeregelte Strecke')
xlabel('Zeit in Sek.')
