find the absolute maximum and minimum values of f on the set D
14 views (last 30 days)
Show older comments
f(x,y)=exp.^(-x^2-y^2)(x^2+2y^2) with D is the disk x^2 + y^2 <=4
0 Comments
Answers (1)
Ameer Hamza
on 22 Jun 2020
Although you can use fmincon() and specify the nonlinear constraint, this function is multi-modal, and the search region is quite small, so it might be better to use a mesh and search for the smallest and largest value
f = @(x,y) exp(-x.^2-y.^2).*(x.^2+2*y.^2);
[X, Y] = meshgrid(-2:0.01:2);
mask = X.^2 + Y.^2 - 4 <= 0;
X(~mask) = nan;
Y(~mask) = nan;
Z = f(X, Y);
min_val = min(Z, [], 'all');
max_val = max(Z, [], 'all');
0 Comments
See Also
Categories
Find more on NaNs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!