% Generates Fig 11.7 (esterror)
% Computer Controlled Systems (3rd ed)
% Author: B. Wittenmark
% Last edit: 1997-07-10
% Copyright (c) 1996 by K. J. Åström, B. Wittenmark and
% Department of Automatic Control, Lund Institute of
% Technology, Lund, Sweden

newplot;clf;
set(gcf,'PaperUnits','centimeters','PaperPosition',[2 2 13 10])
set(gcf,'Units','centimeters','position',get(gcf,'PaperPosition'))


blockest;

lw=0.9;
h=1;
sig=1;
ifix=1;
k0=0.01;
%
[t,x,y]=sim('blockest',[0, 500]);
subplot(3,1,1);
plot(t,y(:,1),'m',t,y(:,2),'m--','Linew',lw);
axis([0,500,-1,2]);
%title(['Fig 11.7']);
set(gca,'Fontsize',9,'Fontname','NewCenturySchlbk');
set(gca,'ytick',[-1 0 1]);
set(gca,'xtick',[0 500]);
text(-50,1.9,'(a)','Fontsize',9,'Fontname','NewCenturySchlbk');
ylabel('Error','Fontname','NewCenturySchlbk','Fontsize',9)
drawnow;
%
k0=0.05;
%
[t,x,y]=sim('blockest',[0, 500]);
subplot(3,1,2);
plot(t,y(:,1),'m',t,y(:,2),'m--','Linew',lw);
axis([0,500,-1,2]);
set(gca,'Fontsize',9,'Fontname','NewCenturySchlbk');
set(gca,'ytick',[-1 0 1]);
set(gca,'xtick',[0 500]);
text(-50,1.9,'(b)','Fontsize',9,'Fontname','NewCenturySchlbk');
ylabel('Error','Fontname','NewCenturySchlbk','Fontsize',9)
drawnow;
%
ifix=0;
%
[t,x,y]=sim('blockest',[0, 500]);
subplot(3,1,3);
plot(t,y(:,1),'m',t,y(:,2),'m--','Linew',lw);
axis([0,500,-1,2]);
set(gca,'Fontsize',9,'Fontname','NewCenturySchlbk');
set(gca,'ytick',[-1 0 1]);
set(gca,'xtick',[0 500]);
text(-50,1.9,'(c)','Fontsize',9,'Fontname','NewCenturySchlbk');
ylabel('Error','Fontname','NewCenturySchlbk','Fontsize',9)
xlabel('Time','Fontname','NewCenturySchlbk','Fontsize',9)
drawnow;
