  a = 0;
  b = 7;
  xbest = a;
  fbest = myf(xbest);
  m = 50;

  xdata = zeros(m,1);
  fdata = zeros(m,1);
  for i= 1 : m

    x = a + (b-a) * rand();

    [xdata(i),fdata(i)] = fmincon(@myf,x,[],[],[],[],a,b);
    xdata(i)
    fprintf ( 1, '  XOPT = %f, FOPT = %f\n', xopt, fopt );

    if ( fdata(i) < fbest )
      xbest = xdata(i);
      fbest = fdata(i);
    end

  end

  for i= 1 : m

    fprintf ( 1, '  XDATA = %f, FDATA = %f\n', xdata(i), fdata(i) );

  end
  x = linspace ( 0, 7, 500 );
  fx = myf ( x );
  plot ( x, fx, 'r-', 'LineWidth', 2 );
  hold on
  plot ( xdata, fdata, 'b*', 'MarkerSize', 15 );
  xlabel ( 'X' )
  ylabel ( 'Y' )
  title ( 'Result of 50 randomized minimizations' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  XBEST = %f, FBEST = %f\n', xbest, fbest );
