a=zeros(200); mx=0;
for x=- .9:.01:.9
for y=- .9:.01: .9
v=(3*x*y+1)*exp(-x^2-y^2);
a(round((x+1)*100),round((y+1)*100))=v;
if v>mx mx=v; mxx=x; mxy=y; end
end
end
disp([mx,mxx,mxy])
mx=0;
for x=.4:.0000000001:.41
v=(3*x*x+1)*exp(-x^2-x^2);
if v>mx mx=v;mxx=x;
end
end
disp([mx,mxx])
The max is about 1.07479696586068 for x=y= 0.4082482808
and the same for x=y= - 0.4082482808
|
Posted by Charlie
on 2020-11-25 14:24:53 |