%
%  driver for an IIR implementation of a plant
%
  clear variables
%
  Ts = 0.1;
  Tf = 3.0;
  t = [0:Ts:Tf];
  N = length(t);
%
%  determine the input (reference) signal
%
  r = ones(1,length(t));
% 
% prepare the reference signal and the corresponding time for Simulink
%
  rt = [t' r'];
%
%  determine the discrete-time transfer function, in terms of z
%
  Gp = tf([0 1],[ 1 -0.8],Ts);
%
%  get the numerator and denominator polynomials
%
  [Bp, Ap] = tfdata(Gp,'v')
%
%  determine the order 
%
  Nbp = length(Bp)
%
%  simulate the step response in Matlab
%
  yfinal = lsim(Gp, r(1:N), t(1:N));
%
%  run the simulation
%
  sim('openloop_DE');
%
%  Now plot the results
%
figure;
%plot(t,yfinal,'+'); grid; 
plot(ts,ys,'o',t,yfinal,'+'); grid; 
legend('Simulink ','Matlab');
xlabel('Time'); ylabel('y value');
 