% Script e6 Time response to piecewise constant input
  clear % removes all variables from the workspace
  G = tf([3 2],[2 4 5 1]) % create G(s)
  pause
  time = [0:0.02:10]'; % create vector with 501 time samples
  u = 2.0*(1+0*(time)); % vector of 2's with length of "time"
  for ii=min(find(time>=3.0)):length(u)
  u(ii) = 0.7;
  end
  y = lsim(G,u,time); % Compute response
  plot(time,y,time,u,'--');grid
  legend('y(t)','u(t)')
  