clear;
syms x y;
z=4*(x-y)-x^2-y^2;
ezsurf(x,y,z)
view(-30,15)
[x1,y1]=solve(diff(z,x),diff(z,y))
z1=4*(x1-y1)-x1^2-y1^2
得到极值点:
x1 = 2
y1 = -2
z1=8
函数如下: