%
%  Second example for dop0
%
%  set the initial parameters
%
  s0 = [0;0];
  tf = 1; 
  u = [1:-0.25:0];
  k = -7;
  tol = 5e-5;
  mxit = 500;
%
%  run the code
%
  [u,s,la0] = dop0('bobs_dop0_a',u,s0,tf,k,tol,mxit);
  fprintf(1,'Final cost is  %f \n', s(2,end))
  u
%
%  Now plot the results
%
  dt = tf/length(u);
  time = [0:length(u)]*dt;
  orient tall
  subplot(3,1,1); plot(time(1:end-1),u); grid; ylabel('u(t)');
  subplot(3,1,2); plot(time,s(1,:)); grid; ylabel('v(t)');
  subplot(3,1,3); plot(time,s(1,:)); grid; ylabel('x(t)'); xlabel('Time (sec)');
%
      