% optm.m  find minimum
function optm
  format compact
  zz=0;
  for xx=-1.0:0.01:1.0
    for yy=-1.0:0.01:1.0
      vv=[ xx yy ];
      a=fminsearch(@f,vv);
      best=f(a);
      if(best<zz)
        aa=a;
        zz=best;
      end
    end
  end
  aa
  zz
  zz=0;
  for xx=-1.0:0.01:1.0
    for yy=-1.0:0.01:1.0
      vv=[ xx yy ];
      a=fminsearch(@f,vv,optimset('MaxFunEvals',1000000));
      best=f(a);
      if(best<zz)
        aa=a;
        zz=best;
      end
    end
  end
  aa
  zz
  return

  function z=f(v)
    x=v(1);
    y=v(2);
    z = sin(10.0*x)+sin(15.0*y)
    return
  end % f
end % optm
% after a long time and error messages
% aa =
% zz = -2.000
