⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function_plot.m

📁 画函数用的matlab界面源代码 多多指教
💻 M
字号:
function varargout = function_plot(varargin)% FUNCTION_PLOT M-file for function_plot.fig%      FUNCTION_PLOT, by itself, creates a new FUNCTION_PLOT or raises the existing%      singleton*.%%      H = FUNCTION_PLOT returns the handle to a new FUNCTION_PLOT or the handle to%      the existing singleton*.%%      FUNCTION_PLOT('CALLBACK',hObject,eventData,handles,...) calls the local%      function named CALLBACK in FUNCTION_PLOT.M with the given input arguments.%%      FUNCTION_PLOT('Property','Value',...) creates a new FUNCTION_PLOT or raises the%      existing singleton*.  Starting from the left, property value pairs are%      applied to the GUI before function_plot_OpeningFcn gets called.  An%      unrecognized property name or invalid value makes property application%      stop.  All inputs are passed to function_plot_OpeningFcn via varargin.%%      *See GUI Options on GUIDE's 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 function_plot% Last Modified by GUIDE v2.5 10-Apr-2008 20:38:19% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...                   'gui_Singleton',  gui_Singleton, ...                   'gui_OpeningFcn', @function_plot_OpeningFcn, ...                   'gui_OutputFcn',  @function_plot_OutputFcn, ...                   'gui_LayoutFcn',  [] , ...                   'gui_Callback',   []);if nargin && ischar(varargin{1})    gui_State.gui_Callback = str2func(varargin{1});endif nargout    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});else    gui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before function_plot is made visible.function function_plot_OpeningFcn(hObject, eventdata, handles, varargin)% 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 function_plot (see VARARGIN)% Choose default command line output for function_plothandles.output = hObject;% Update handles structureguidata(hObject, handles);x1 = eval(get(handles.x1,'String'));x2 = eval(get(handles.x2,'String'));x=x1:0.01:x2;y=eval(get(handles.y,'String'));% Create  plotaxes(handles.axes1)plot(x,y)set(handles.axes1,'XMinorTick','on')grid on% UIWAIT makes function_plot wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = function_plot_OutputFcn(hObject, eventdata, handles) % 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 structurevarargout{1} = handles.output;% --------------------------------------------------------------------function problem_Callback(hObject, eventdata, handles)% hObject    handle to problem (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function About_Callback(hObject, eventdata, handles)% hObject    handle to About (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function Help_Callback(hObject, eventdata, handles)% hObject    handle to Help (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function Author_Callback(hObject, eventdata, handles)% hObject    handle to Author (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)helpdlg({'版权归林骥所有'...                'Email:linji@live.com'...                'QQ:849819737'},'关于作者')% --------------------------------------------------------------------function problem1_Callback(hObject, eventdata, handles)% hObject    handle to problem1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function problem2_Callback(hObject, eventdata, handles)% hObject    handle to problem2 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function problem3_Callback(hObject, eventdata, handles)% hObject    handle to problem3 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function problem4_Callback(hObject, eventdata, handles)% hObject    handle to problem4 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function problem5_Callback(hObject, eventdata, handles)% hObject    handle to problem5 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function problem6_Callback(hObject, eventdata, handles)% hObject    handle to problem6 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --- Executes on button press in Close.function Close_Callback(hObject, eventdata, handles)% hObject    handle to Close (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Get the current position of the GUI from the handles structure% to pass to the modal dialog.pos_size = get(handles.figure1,'Position');% Call modaldlg with the argument 'Position'.user_response = questdlg('您确定要关闭吗?','确定关闭','是','否','是');switch user_responsecase {'否'}	% take no actioncase '是'	% Prepare to close GUI application window	%                  .	%                  .	%                  .	delete(handles.figure1)    helpdlg({'感谢使用!欢迎提出您的宝贵意见发送Email到:linji@live.com'},'谢谢')end% --- Executes during object creation, after setting all properties.function Close_CreateFcn(hObject, eventdata, handles)% hObject    handle to Close (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% --- Executes on button press in Plot.function Plot_Callback(hObject, eventdata, handles)% hObject    handle to Plot (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Get user input from GUIx1 = eval(get(handles.x1,'String'));x2 = eval(get(handles.x2,'String'));x=x1:0.01:x2;tryy=get(handles.y,'String');y=eval(y);% Create  plotaxes(handles.axes1)plot(x,y)set(handles.axes1,'XMinorTick','on')grid oncatch    helpdlg('请输入正确的函数表达式.注意:乘除幂的运算符前应该加点!','友情提醒')   endfunction x1_Callback(hObject, eventdata, handles)% hObject    handle to x1 (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 x1 as text%        str2double(get(hObject,'String')) returns contents of x1 as a double% --- Executes during object creation, after setting all properties.function x1_CreateFcn(hObject, eventdata, handles)% hObject    handle to x1 (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,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');endfunction 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, after setting all properties.function edit2_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit2 (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,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');endfunction x2_Callback(hObject, eventdata, handles)% hObject    handle to x2 (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 x2 as text%        str2double(get(hObject,'String')) returns contents of x2 as a double% --- Executes during object creation, after setting all properties.function x2_CreateFcn(hObject, eventdata, handles)% hObject    handle to x2 (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,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');endfunction y_Callback(hObject, eventdata, handles)% hObject    handle to y (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 y as text%        str2double(get(hObject,'String')) returns contents of y as a double% --- Executes during object creation, after setting all properties.function y_CreateFcn(hObject, eventdata, handles)% hObject    handle to y (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,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end% --------------------------------------------------------------------function How_Callback(hObject, eventdata, handles)% hObject    handle to How (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)open('help.doc')% --------------------------------------------------------------------function Untitled_1_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function F_Close_Callback(hObject, eventdata, handles)% hObject    handle to F_Close (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Get the current position of the GUI from the handles structure% to pass to the modal dialog.pos_size = get(handles.figure1,'Position');% Call modaldlg with the argument 'Position'.user_response = questdlg('您确定要关闭吗?','确定关闭','是','否','是');switch user_responsecase {'否'}	% take no actioncase '是'	% Prepare to close GUI application window	%                  .	%                  .	%                  .	delete(handles.figure1)    helpdlg({'感谢使用!欢迎提出您的宝贵意见发送Email到:linji@live.com'},'谢谢')end% --- Executes when figure1 is resized.function figure1_ResizeFcn(hObject, eventdata, handles)% hObject    handle to figure1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -