Locating max/min of 3d surface
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!