t=-10:0.1:10;y=sin(t).^2+t.^2/100;plot(t,y),grid on,hold ontitle('f(x)=sin(x)^2+x^2/100图像及最小值点')x1=-10:1.5:10;f=@(x)sin(x).^2+x.^2/100;for k=1:length(x1) x0=x1(k);[x,fval]=fminsearch(f,x0);plot(x,fval,'r*')end按上面程序试试