

1 function varargout = GUI013(varargin) 2 % GUI013 MATLAB code for GUI013.fig 3 % GUI013, by itself, creates a new GUI013 or raises the existing 4 % singleton*. 5 % 6 % H = GUI013 returns the handle to a new GUI013 or the handle to 7 % the existing singleton*. 8 % 9 % GUI013('CALLBACK',hObject,eventData,handles,...) calls the local 10 % function named CALLBACK in GUI013.M with the given input arguments. 11 % 12 % GUI013('Property','Value',...) creates a new GUI013 or raises the 13 % existing singleton*. Starting from the left, property value pairs are 14 % applied to the GUI before GUI013_OpeningFcn gets called. An 15 % unrecognized property name or invalid value makes property application 16 % stop. All inputs are passed to GUI013_OpeningFcn via varargin. 17 % 18 % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one 19 % instance to run (singleton)". 20 % 21 % See also: GUIDE, GUIDATA, GUIHANDLES 22 23 % Edit the above text to modify the response to help GUI013 24 25 % Last Modified by GUIDE v2.5 23-Jan-2018 19:35:30 26 27 % Begin initialization code - DO NOT EDIT 28 gui_Singleton = 1; 29 gui_State = struct('gui_Name', mfilename, ... 30 'gui_Singleton', gui_Singleton, ... 31 'gui_OpeningFcn', @GUI013_OpeningFcn, ... 32 'gui_OutputFcn', @GUI013_OutputFcn, ... 33 'gui_LayoutFcn', [] , ... 34 'gui_Callback', []); 35 if nargin && ischar(varargin{1}) 36 gui_State.gui_Callback = str2func(varargin{1}); 37 end 38 39 if nargout 40 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); 41 else 42 gui_mainfcn(gui_State, varargin{:}); 43 end 44 % End initialization code - DO NOT EDIT 45 46 47 % --- Executes just before GUI013 is made visible. 48 function GUI013_OpeningFcn(hObject, eventdata, handles, varargin) 49 % This function has no output args, see OutputFcn. 50 % hObject handle to figure 51 % eventdata reserved - to be defined in a future version of MATLAB 52 % handles structure with handles and user data (see GUIDATA) 53 % varargin command line arguments to GUI013 (see VARARGIN) 54 55 % Choose default command line output for GUI013 56 handles.output = hObject; 57 58 handles.x = -pi:0.01:pi; 59 60 61 62 63 % Update handles structure 64 guidata(hObject, handles); 65 66 % UIWAIT makes GUI013 wait for user response (see UIRESUME) 67 % uiwait(handles.figure1); 68 69 70 % --- Outputs from this function are returned to the command line. 71 function varargout = GUI013_OutputFcn(hObject, eventdata, handles) 72 % varargout cell array for returning output args (see VARARGOUT); 73 % hObject handle to figure 74 % eventdata reserved - to be defined in a future version of MATLAB 75 % handles structure with handles and user data (see GUIDATA) 76 77 % Get default command line output from handles structure 78 varargout{1} = handles.output; 79 80 81 % --- Executes on button press in sin. 82 function sin_Callback(hObject, eventdata, handles) 83 % hObject handle to sin (see GCBO) 84 % eventdata reserved - to be defined in a future version of MATLAB 85 % handles structure with handles and user data (see GUIDATA) 86 x = handles.x; 87 y = sin(x); 88 plot(handles.plotarea,x,y,'b') 89 90 91 % --- Executes on button press in cos. 92 function cos_Callback(hObject, eventdata, handles) 93 % hObject handle to cos (see GCBO) 94 % eventdata reserved - to be defined in a future version of MATLAB 95 % handles structure with handles and user data (see GUIDATA) 96 97 x = handles.x; 98 y = cos(x); 99 plot(handles.plotarea,x,y,'g') 100 101 102 103 104 % --- Executes on button press in tan. 105 function tan_Callback(hObject, eventdata, handles) 106 % hObject handle to tan (see GCBO) 107 % eventdata reserved - to be defined in a future version of MATLAB 108 % handles structure with handles and user data (see GUIDATA) 109 110 x = handles.x; 111 y =1/200*tan(x); 112 plot(handles.plotarea,x,y,'r') 113 114 115 % --- Executes on button press in clear. 116 function clear_Callback(hObject, eventdata, handles) 117 % hObject handle to clear (see GCBO) 118 % eventdata reserved - to be defined in a future version of MATLAB 119 % handles structure with handles and user data (see GUIDATA) 120 try 121 delete(allchild(handles.plotarea)); 122 end