matlab中 作出函数f(x,y)=y^3/9+3*x^2*y+9*x^2+y^2+x*y+9,-2<x<1,-7<y<1的图,观察极值点的位置并求出
1个回答
展开全部
[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
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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询