[x,y]=meshgrid(linspace(-2,1,30),linspace(-7,1,30));
f=y.^3/9+3*x.^2.*y+9.*x.^2+y.^2+x.*y+9;
surf(x,y,f);
MAX=imregionalmax(f);
for i=1:1:30
for j=1:1:30
if(MAX(i,j)==1)
hold on;
plot3(x(i,j),y(i,j),f(i,j),'r*');
text(x(i,j),y(i,j),f(i,j),'极大值点');
end
end
end