function varargout = bif(varargin) % BIF M-file for bif.fig % BIF, by itself, creates a new BIF or raises the existing % singleton*. % % H = BIF returns the handle to a new BIF or the handle to % the existing singleton*. % % BIF('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in BIF.M with the given input arguments. % % BIF('Property','Value',...) creates a new BIF or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before bif_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to bif_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 % Copyright 2002-2003 The MathWorks, Inc. % Edit the above text to modify the response to help bif % Last Modified by GUIDE v2.5 29-Apr-2007 23:19:27 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @bif_OpeningFcn, ... 'gui_OutputFcn', @bif_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if 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 bif is made visible. function bif_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 bif (see VARARGIN) % Choose default command line output for bif handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes bif wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = bif_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 structure varargout{1} = handles.output; % Связь события CloseRequestFcn с подфункцией Close set(handles.output, 'CloseRequestFcn',{@Close,handles}) function Close(hObject,eventdata,handles)% Подфункция обработки события CloseRequestFcn окна приложения % Вывод модального диалогового окна с подтверждением закрытия q=questdlg('Закрыть приложение?','!!Информация!!','Да','Нет','Да'); % Проверка выбора пользователя if strcmp(q,'Да') % Пользователь подтвердил закрытие приложения, % удаляем окно приложения delete(handles.output) end % --- Executes on button press in btnPlot. function btnPlot_Callback(hObject, eventdata, handles) % hObject handle to btnPlot (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global RHSNAME RHSNAME=get(handles.EdtF,'string') % the resolution of the image % 90 x 90 should work in the student version pres = 900; xres = 900; % warmup is the number of iterations to perform % before plotting. running is the number of points to % really compute. warmup = 500; running = 1000; % pict stores the picture pict = ones(pres,xres); % get parameter range: p0 = str2double(get(handles.EdtP1,'String'))%input('Please enter smallest parameter value -> '); p1 = str2double(get(handles.EdtP2,'String'))%input('Please enter largest parameter value -> '); pvec = [p0 : (p1-p0)/(pres-1) : p1]; % get variable range: x0 = str2double(get(handles.EdtX1,'String'))%input('Please enter smallest x value we should see -> '); x1 = str2double(get(handles.EdtX2,'String'))%input('Please enter largest x value we should see -> '); % we start the x's in the middle of the range x = ones(1,pres)*(x0+x1)/2; for k=1:warmup x = feval(RHSNAME,x,pvec); end; for k=1:running x = feval(RHSNAME,x,pvec); idx = ceil( (xres-1).*(x-x0)./(x1-x0) ) + 1; hits = find( (idx>=1) & (idx <= xres)); for i = 1:length(hits) pict(hits(i), idx(hits(i)) ) = 2; end; end; image(pict'); colormap([0 0 0; 1 1 1]); axis('image'); axis('xy'); axis('off'); set(handles.btnClear, 'Enable', 'on') function EdtP1_Callback(hObject, eventdata, handles) % hObject handle to EdtP1 (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 EdtP1 as text % str2double(get(hObject,'String')) returns contents of EdtP1 as a double % --- Executes during object creation, after setting all properties. function EdtP1_CreateFcn(hObject, eventdata, handles) % hObject handle to EdtP1 (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 EdtF_Callback(hObject, eventdata, handles) % hObject handle to EdtF (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 EdtF as text % str2double(get(hObject,'String')) returns contents of EdtF as a double % --- Executes during object creation, after setting all properties. function EdtF_CreateFcn(hObject, eventdata, handles) % hObject handle to EdtF (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 % --- Executes on button press in btnF. function btnF_Callback(hObject, eventdata, handles) % hObject handle to btnF (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global RHSNAME RHSNAME='quadrat' [flname, pname] = uigetfile('*.*','Выбор имени функции'); % получение имени и пути к файлу % Проверка, был ли открыт файл if flname ~= 0 % Образование полного имени файла RHSNAME = strrep(flname,'.m',''); end set(handles.EdtF,'string',RHSNAME); % --- Executes on button press in btnClear. function btnClear_Callback(hObject, eventdata, handles) % hObject handle to btnClear (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) cla % очистка осей % Кнопка Очистить должна стать недоступной после очистки осей set(hObject, 'Enable', 'off') % Кнопка Построить должна стать доступной set(handles.btnPlot, 'Enable', 'on') function EdtP2_Callback(hObject, eventdata, handles) % hObject handle to EdtP2 (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 EdtP2 as text % str2double(get(hObject,'String')) returns contents of EdtP2 as a double % --- Executes during object creation, after setting all properties. function EdtP2_CreateFcn(hObject, eventdata, handles) % hObject handle to EdtP2 (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 EdtX1_Callback(hObject, eventdata, handles) % hObject handle to EdtX1 (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 EdtX1 as text % str2double(get(hObject,'String')) returns contents of EdtX1 as a double % --- Executes during object creation, after setting all properties. function EdtX1_CreateFcn(hObject, eventdata, handles) % hObject handle to EdtX1 (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 EdtX2_Callback(hObject, eventdata, handles) % hObject handle to EdtX2 (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 EdtX2 as text % str2double(get(hObject,'String')) returns contents of EdtX2 as a double % --- Executes during object creation, after setting all properties. function EdtX2_CreateFcn(hObject, eventdata, handles) % hObject handle to EdtX2 (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