% Generates Fig 3.20 % Computer Controlled Systems (3rd ed) % Author: B. Wittenmark % Last edit: 1997-06-30 % Copyright (c) 1996 by K. J. Åström, B. Wittenmark and % Department of Automatic Control, Lund Institute of % Technology, Lund, Sweden clear all; close all; block320; newplot;clf; set(gcf,'PaperUnits','centimeters','PaperPosition',[2 2 13 10]) set(gcf,'Units','centimeters','position',get(gcf,'PaperPosition')) lw=2; Ms=30; opt=simset('Outputpoints','specified'); % subplot(2,1,1); [t,x,y]=sim('block320',[0, 10]); [t2,x,y2]=sim('block320',[0:1:10],opt); hpl=plot(t2,y2(:,1),'r.',t,y(:,2),'k--','Linew',lw); hold on; %hpl=plot(t2,y2(:,1),'r.',t,y(:,1),'k',t,y(:,2),'k--','Linew',lw); set(hpl,'MarkerSize',Ms) %title('Fig 3.20'); set(gca,'xtick',[0 5 10],'ytick',[0 1]); set(gca,'Fontsize',9,'Fontname','NewCenturySchlbk'); ylabel('Output','Fontname','NewCenturySchlbk','Fontsize',9) axis([0,10,0,1.7]); drawnow; % subplot(2,1,2); [ts,ys]=stairs(t,y(:,3)); plot(ts,ys, 'r','Linew',lw); axis([0,10,-7,7]); set(gca,'xtick',[0 5 10],'ytick',[-5 0 5]); set(gca,'Fontsize',9,'Fontname','NewCenturySchlbk'); ylabel('Input','Fontname','NewCenturySchlbk','Fontsize',9) xlabel('Time','Fontname','NewCenturySchlbk','Fontsize',9) drawnow; % pause ylblalgn; subplot(2,1,1); plot(t,y(:,1),'k',t,y(:,2),'k--','Linew',lw);