matlab多元函数求极值 求函数f(x,y)=4(x-y)-x^2-y^2的极值
问题描述:
matlab多元函数求极值 求函数f(x,y)=4(x-y)-x^2-y^2的极值
答
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
函数如下: