[A,B,C,D]=cstr(1,.5);

%
dt=0.1;
tf=10;
t = (0:dt:tf);

[y,x]=step(A,B,C,D,1,t);
y_min=min(y);
y_max=max(y);


% simulate real time

% the square
  
c = ones(10,10);
c(1,1)=0;

slow=2;

figure(1)
hold off
clg
axis([0 tf y_min y_max]);
title('Step Response')
xlabel('Time [min]')
ylabel('output')
hold on

figure(2)
hold off
clg
colormap(hsv);
axis([2 5 2 5])
title('Temperature in the box')
hold on

for i=1:length(t)-1,

% Step response
  figure(1)
  plot([t(i) t(i+1)],[y(i) y(i+1)],'-g')
%  pause(slow);

  % Temperature stuff
  figure(2)
  cc=ceil(y(i+1)*64/y_max);
  col=cc*c;
  col(10-1,10-1)=64;
  pcolor(col)
%  pause(slow)
end;

hold off
