Locating max/min of 3d surface
5 views (last 30 days)
Show older comments
How could I go about locating the global min/max of a user input function. The GUI plots a function based on user input:
% Get the function
g=get(handles.funcxy,'String');
% Get the x limits
limit=[str2num(char(get(handles.xmin,'String'))),... str2num(char(get(handles.xmax,'String')))];
% Convert to inline for plotting
func=inline(char(g));
% Set axes to draw on
axes(handles.plot);
% Plot the surface defined by a function f(x,y)=func
ezsurf(func,limit);
I have figured out in order to find the z maximum I can do
sh=ezsurf(func,limit);
setappdata(0, 'function', char(g));
zd=get(sh,'zdata');
zmax=max(max(zd));
But how can I get the corresponding x,y points
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots 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!