function fig = graph3d() % GRAPH3D Graphs up to two two-variable functions in three dimensions % Graph3d will graph up to two functions of two variables in three % dimensions and allow you to rotate the resulting graph. You must % specify the x and y limits; the z limits are then automatically % computed to fit the graphs. The x and y scales can be changed % for finer detail. Note that the functions are vectorized before % evaluation. This means they should be entered as symbolic objects % with no use of .*, ./, or .^. The variables used must be x and y % in lower case. The second function has the same colormap as the % first, only reversed. % Created by Mark D. Schlatter mschlat@centenary.edu % Last modifed: 8/21/98 % This is the machine-generated representation of a Handle Graphics object % and its children. Note that handle values may change when these objects % are re-created. This may cause problems with any callbacks written to % depend on the value of the handle at the time the object was saved. % % To reopen this object, just type the name of the M-file at the MATLAB % prompt. The M-file and its associated MAT-file must be on your path. load graph3d h0 = figure('Color',[0.8 0.8 0.8], ... 'Colormap',mat0, ... 'Name','Graphing in 3D', ... 'PaperOrientation','landscape', ... 'PaperPosition',[2.270833333333333 2.0625 6.458333333333333 4.375], ... 'PaperPositionMode','auto', ... 'PointerShapeCData',mat1, ... 'Position',[7 15 620 420], ... 'Renderer','zbuffer', ... 'RendererMode','manual', ... 'Tag','Fig1', ... 'WindowButtonDownFcn','rotate3d(''down'')', ... 'WindowButtonUpFcn','rotate3d(''up'')'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941 0.752941 0.752941], ... 'ListboxTop',0, ... 'Position',[337.5 286.5 90 15], ... 'String','Your first function', ... 'Style','text', ... 'Tag','functiontext'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[352.5 270 90 15], ... 'String','x^2+y^2', ... 'Style','edit', ... 'Tag','function1graph3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941 0.752941 0.752941], ... 'ListboxTop',0, ... 'Position',[337.5 156 43.5 15], ... 'String','xmin', ... 'Style','text', ... 'Tag','StaticText2'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[393.75 154.5 27 15.75], ... 'String','-4', ... 'Style','edit', ... 'Tag','xmingraph3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[393 133.5 27 15.75], ... 'String','4', ... 'Style','edit', ... 'Tag','xmaxgraph3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'ListboxTop',0, ... 'Position',[336.75 133.5 43.5 15], ... 'String','xmax', ... 'Style','text', ... 'Tag','ymax'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[393 110.25 27 15.75], ... 'String','.1', ... 'Style','edit', ... 'Tag','xsclgraph3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'ListboxTop',0, ... 'Position',[336 111 43.5 15], ... 'String','xscl', ... 'Style','text', ... 'Tag','StaticText7'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941 0.752941 0.752941], ... 'ListboxTop',0, ... 'Position',[336.75 37.5 43.5 15], ... 'String','yscl', ... 'Style','text', ... 'Tag','StaticText6'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[393.75 37.5 27 15.75], ... 'String','.1', ... 'Style','edit', ... 'Tag','ysclgraph3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941 0.752941 0.752941], ... 'ListboxTop',0, ... 'Position',[336.75 60 43.5 15], ... 'String','ymax', ... 'Style','text', ... 'Tag','StaticText5'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[393.75 60 27 15.75], ... 'String','2', ... 'Style','edit', ... 'Tag','ymaxgraph3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[393.75 81.75 27 15.75], ... 'String','-2', ... 'Style','edit', ... 'Tag','ymingraph3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... 'ListboxTop',0, ... 'Position',[337.5 82.5 43.5 15], ... 'String','ymin', ... 'Style','text', ... 'Tag','StaticText2'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... 'ListboxTop',0, ... 'Position',[337.5 270 15 15], ... 'String','z=', ... 'Style','text', ... 'Tag','StaticText9'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'Callback',mat2, ... 'ListboxTop',0, ... 'Position',[337.5 247.5 45 15], ... 'String','Graph', ... 'Tag','Pushbutton2'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'Callback','delete(findobj(''Tag'',''firstf''))', ... 'ListboxTop',0, ... 'Position',[397.5 247.5 45 15], ... 'String','Clear', ... 'Tag','Pushbutton3'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'Callback','delete(findobj(''Tag'',''secondf''))', ... 'ListboxTop',0, ... 'Position',[397.5 178.5 45 15], ... 'String','Clear', ... 'Tag','Pushbutton3'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'Callback',mat3, ... 'ListboxTop',0, ... 'Position',[337.5 178.5 45 15], ... 'String','Graph', ... 'Tag','Pushbutton2'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... 'ListboxTop',0, ... 'Position',[337.5 201 15 15], ... 'String','z=', ... 'Style','text', ... 'Tag','StaticText9'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[352.5 201 90 15], ... 'Style','edit', ... 'Tag','function2graph3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941 0.752941 0.752941], ... 'ListboxTop',0, ... 'Position',[337.5 217.5 90 15], ... 'String','Your second function', ... 'Style','text', ... 'Tag','functiontext'); h1 = axes('Parent',h0, ... 'CameraUpVector',[0 1 0], ... 'CameraUpVectorMode','manual', ... 'Color',[1 1 1], ... 'ColorOrder',mat4, ... 'Position',mat5, ... 'Tag','Axes1', ... 'XColor',[0 0 0], ... 'XGrid','on', ... 'YColor',[0 0 0], ... 'YGrid','on', ... 'ZColor',[0 0 0]); h2 = text('Parent',h1, ... 'Color',[0 0 0], ... 'HandleVisibility','off', ... 'HorizontalAlignment','center', ... 'Position',[0.4966216216216216 -0.08540925266903909 9.160254037844386], ... 'Tag','Axes1Text4', ... 'VerticalAlignment','cap'); set(get(h2,'Parent'),'XLabel',h2); h2 = text('Parent',h1, ... 'Color',[0 0 0], ... 'HandleVisibility','off', ... 'HorizontalAlignment','center', ... 'Position',mat6, ... 'Rotation',90, ... 'Tag','Axes1Text3', ... 'VerticalAlignment','baseline'); set(get(h2,'Parent'),'YLabel',h2); h2 = text('Parent',h1, ... 'Color',[0 0 0], ... 'HandleVisibility','off', ... 'HorizontalAlignment','right', ... 'Position',[-0.25 1.213523131672598 9.160254037844386], ... 'Tag','Axes1Text2', ... 'Visible','off'); set(get(h2,'Parent'),'ZLabel',h2); h2 = text('Parent',h1, ... 'Color',[0 0 0], ... 'HandleVisibility','off', ... 'HorizontalAlignment','center', ... 'Position',mat7, ... 'Tag','Axes1Text1', ... 'VerticalAlignment','bottom'); set(get(h2,'Parent'),'Title',h2); if nargout > 0, fig = h0; end