《MATLAB一元二次函数的画》由会员分享,可在线阅读,更多相关《MATLAB一元二次函数的画(6页珍藏版)》请在金锄头文库上搜索。
1、function varargout = huatu(varargin)% HUATU MATLAB code for huatu.fig% HUATU, by itself, creates a new HUATU or raises the existing% singleton*.% H = HUATU returns the handle to a new HUATU or the handle to% the existing singleton*.% HUATU(CALLBACK,hObject,eventData,handles,.) calls the local% funct
2、ion named CALLBACK in HUATU.M with the given input arguments.% HUATU(Property,Value,.) creates a new HUATU or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before huatu_OpeningFcn gets called. An% unrecognized property name or invalid value mak
3、es property application% stop. All inputs are passed to huatu_OpeningFcn via varargin.% *See GUI Options on GUIDEs Tools menu. Choose GUI allows only one% instance to run (singleton).% See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help huatu % Last Modified by
4、GUIDE v2.5 15-Jan-2014 13:13:56 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, huatu_OpeningFcn, . gui_OutputFcn, huatu_OutputFcn, . gui_LayoutFcn, , . gui_Callback, );if nargin & ischar(varargin1)
5、gui_State.gui_Callback = str2func(varargin1);end if nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT % - Executes just before huatu is made visible.function huatu_OpeningFcn(hObject, eventdata, handles, v
6、arargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to huatu (see VARARGIN) % Choose default command line ou
7、tput for huatuhandles.output = hObject; % Update handles structureguidata(hObject, handles); % UIWAIT makes huatu wait for user response (see UIRESUME)% uiwait(handles.figure1); % - Outputs from this function are returned to the command line.function varargout = huatu_OutputFcn(hObject, eventdata, h
8、andles) % varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structurevarargout1 = handl
9、es.output; % - Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)a=str2num(get(handl
10、es.edit1,string);b=str2num(get(handles.edit2,string);c=str2num(get(handles.edit3,string);x=-10:1:10;hold on y=a*x.2+b*x+c; plot(x,y); % - Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)% eventdata reserved -
11、 to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)close all function edit1_Callback(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles
12、 and user data (see GUIDATA) % Hints: get(hObject,String) returns contents of edit1 as text% str2double(get(hObject,String) returns contents of edit1 as a double % - Executes during object creation, after setting all properties.function edit1_CreateFcn(hObject, eventdata, handles)% hObject handle to
13、 edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc & isequal(get(hObject,BackgroundColor), get(0,de
14、faultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);end function edit2_Callback(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,String) returns contents of edit2 as text% str2double(get(hObject,String) returns contents of edit2 as a double % - Executes during object creation,