function [xo,Ot,nS,it]=search(S,x0)

[xo,Ot,flag,out]=fminsearch(S,x0);

nS=out.funcCount;
it=out.iterations;