function fig = pcurve3d() % PCURVE3D Graphs a parametric curve and vector field in three dimensions % Pcurve3d graphs a parametric curve and vector field in three dimensions. % The x, y, and z limits must be specified,and if parametric plotting % is desired, the t limits and tscl as well. Tscl determines how often % the functions are consulted when graphing. The parametric functions % must be functions of t (lower case only) while the vector field % functions must be functions of x,y, and z. All functions will be % vectorized before evaluation, so they should be entered like % symbolic functions --- there is no need to use .*,.^, or ./. % For visual clarity, the vector field is plotted on a 5 by 5 by 5 % grid. The velocity and acceleration vectors are placed every tscl % units. % Created by Mark D. Schlatter mschlat@centenary.edu % Last modified: 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 pcurve3d h0 = figure('Color',[0.8 0.8 0.8], ... 'Colormap',mat0, ... 'Name','3D parametric curves and vector fields', ... 'PaperOrientation','landscape', ... 'PaperPosition',mat1, ... 'PaperPositionMode','auto', ... 'PointerShapeCData',mat2, ... 'Position',[1 1 640 442], ... 'Tag','Fig1'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[360 300 75 15], ... 'String','cos(t)', ... 'Style','edit', ... 'Tag','xtpcurve3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... 'ListboxTop',0, ... 'Position',[330 315 90 15], ... 'String','Parametrized Curve', ... 'Style','text', ... 'Tag','StaticText1'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'ListboxTop',0, ... 'Position',[330 300 30 15], ... 'String','x(t)=', ... 'Style','text', ... 'Tag','StaticText2'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'ListboxTop',0, ... 'Position',[330 285 30 15], ... 'String','y(t)=', ... 'Style','text', ... 'Tag','StaticText2'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[360 285 75 15], ... 'String','sin(t)', ... 'Style','edit', ... 'Tag','ytpcurve3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... 'ListboxTop',0, ... 'Position',[330 240 30 15], ... 'String','xmin', ... 'Style','text', ... 'Tag','StaticText10'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[360 240 30 15], ... 'String','-1.5', ... 'Style','edit', ... 'Tag','xminpcurve3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[420 240 30 15], ... 'String','1.5', ... 'Style','edit', ... 'Tag','xmaxpcurve3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'ListboxTop',0, ... 'Position',[390 240 30 15], ... 'String','xmax', ... 'Style','text', ... 'Tag','StaticText3'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[360 225 30 15], ... 'String','-1.5', ... 'Style','edit', ... 'Tag','yminpcurve3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'ListboxTop',0, ... 'Position',[330 225 30 15], ... 'String','ymin', ... 'Style','text', ... 'Tag','StaticText4'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[420 225 30 15], ... 'String','1.5', ... 'Style','edit', ... 'Tag','ymaxpcurve3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'ListboxTop',0, ... 'Position',[390 225 30 15], ... 'String','ymax', ... 'Style','text', ... 'Tag','StaticText5'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[360 195 30 15], ... 'String','0', ... 'Style','edit', ... 'Tag','tminpcurve3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'ListboxTop',0, ... 'Position',[330 195 30 15], ... 'String','tmin', ... 'Style','text', ... 'Tag','StaticText6'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[420 195 30 15], ... 'String','2*pi', ... 'Style','edit', ... 'Tag','tmaxpcurve3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'ListboxTop',0, ... 'Position',[390 195 30 15], ... 'String','tmax', ... 'Style','text', ... 'Tag','StaticText7'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'Callback',mat3, ... 'ListboxTop',0, ... 'Position',[330 150 90 15], ... 'String','Graph the curve', ... 'Tag','Pushbutton1'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'Callback','delete(findobj(''Tag'',''curve3d''));', ... 'ListboxTop',0, ... 'Position',[435 150 30 15], ... 'String','Clear', ... 'Tag','Pushbutton2'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... 'ListboxTop',0, ... 'Position',[330 90 90 15], ... 'String','Vector field', ... 'Style','text', ... 'Tag','fypcurve'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... 'ListboxTop',0, ... 'Position',[330 75 30 15], ... 'String','Fx=', ... 'Style','text', ... 'Tag','fypcurve'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... 'ListboxTop',0, ... 'Position',[330 60 30 15], ... 'String','Fy=', ... 'Style','text', ... 'Tag','fypcurve'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[360 75 75 15], ... 'String','-y', ... 'Style','edit', ... 'Tag','fxpcurve3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[570 75 75 15], ... 'Style','edit', ... 'Tag','fxpcurve'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[360 60 75 15], ... 'String','x', ... 'Style','edit', ... 'Tag','fypcurve3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'Callback',mat4, ... 'ListboxTop',0, ... 'Position',[330 15 90 15], ... 'String','Plot the vector field', ... 'Tag','Pushbutton3'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'Callback','delete(findobj(''Tag'',''vfield3d''));', ... 'ListboxTop',0, ... 'Position',[435 15 30 15], ... 'String','Clear', ... 'Tag','Pushbutton4'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'Callback',mat5, ... 'ListboxTop',0, ... 'Position',[330 135 90 15], ... 'String','Velocity vectors', ... 'Tag','Pushbutton5'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'Callback',mat6, ... 'ListboxTop',0, ... 'Position',[330 120 90 15], ... 'String','Acceleration vectors', ... 'Tag','Pushbutton5'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'Callback','delete(findobj(''Tag'',''velvec3d''));', ... 'ListboxTop',0, ... 'Position',[435 135 30 15], ... 'String','Clear', ... 'Tag','Pushbutton2'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'Callback','delete(findobj(''Tag'',''accvec3d''));', ... 'ListboxTop',0, ... 'Position',[435 120 30 15], ... 'String','Clear', ... 'Tag','Pushbutton2'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... 'ListboxTop',0, ... 'Position',[360 180 30 15], ... 'String','tscl', ... 'Style','text', ... 'Tag','StaticText11'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[390 180 30 15], ... 'String','pi/16', ... 'Style','edit', ... 'Tag','tsclpcurve3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'ListboxTop',0, ... 'Position',[330 210 30 15], ... 'String','zmin', ... 'Style','text', ... 'Tag','StaticText12'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'ListboxTop',0, ... 'Position',[390 210 30 15], ... 'String','zmax', ... 'Style','text', ... 'Tag','StaticText12'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[360 210 30 15], ... 'String','0', ... 'Style','edit', ... 'Tag','zminpcurve3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[420 210 30 15], ... 'String','2*pi', ... 'Style','edit', ... 'Tag','zmaxpcurve3d'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'ListboxTop',0, ... 'Position',[330 45 30 15], ... 'String','Fz=', ... 'Style','text', ... 'Tag','Fz='); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[360 45 75 15], ... 'String','0', ... 'Style','edit', ... 'Tag','fzpcurve3d'); h1 = axes('Parent',h0, ... 'CameraUpVector',[0 1 0], ... 'CameraUpVectorMode','manual', ... 'Color',[1 1 1], ... 'ColorOrder',mat7, ... 'Position',[0.09375 0.1809954751131222 0.5 0.6787330316742082], ... 'Tag','Axes1', ... 'XColor',[0 0 0], ... 'YColor',[0 0 0], ... 'ZColor',[0 0 0]); h2 = text('Parent',h1, ... 'Color',[0 0 0], ... 'HandleVisibility','off', ... 'HorizontalAlignment','center', ... 'Position',[0.4984326018808777 -0.08026755852842804 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',[-0.09717868338557993 0.4949832775919733 9.160254037844386], ... '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.1912225705329154 1.204013377926421 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',[0.4984326018808777 1.023411371237458 9.160254037844386], ... 'Tag','Axes1Text1', ... 'VerticalAlignment','bottom'); set(get(h2,'Parent'),'Title',h2); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... 'ListboxTop',0, ... 'Position',[330 270 30 15], ... 'String','z(t)=', ... 'Style','text', ... 'Tag','StaticText8'); h1 = uicontrol('Parent',h0, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'ListboxTop',0, ... 'Position',[360 270 75 15], ... 'String','t', ... 'Style','edit', ... 'Tag','ztpcurve3d'); if nargout > 0, fig = h0; end