open = load('open.txt');
closed = load('closed.txt');

figure;
plot (open (:,1), open (:,2), 'b'); hold on;
plot (open (:,1), open (:,3), 'g'); grid on;
title ('Odpowiedz ukladu otwartego');
xlabel ('t [s]');
h = legend ('$y$', '$\dot{y}$');
set(h,'Interpreter','latex')


figure;
subplot (2,1,1);
plot (closed (:,1), closed (:,2), 'b'); hold on;
plot (closed (:,1), closed (:,5), 'r');
plot (closed (:,1), closed (:,3), 'g'); grid on;
title ('Odpowiedz ukladu zamknietego');
xlabel ('t [s]');
h = legend ('$y$', '$w$', '$\dot{y}$');
set(h,'Interpreter','latex');
subplot (2,1,2);
plot (closed (:,1), closed (:,4), 'g'); grid on;
title ('Sterowanie z regulatora PID');
xlabel ('t [s]');