function varargout = IVPsolve(varargin)
% main GUI
%
% input: o none
%
% output: o numerical solution
% o errors
% o region of stability
%
% notes: o
%
% authors: o Christian Jkel (University of Technology Dresden)
% o Daniel Klawitter (University of Technology Dresden)
% IVPSOLVE M-file for IVPsolve.fig
% IVPSOLVE, by itself, creates a new IVPSOLVE or raises the existing
% singleton*.
%
% H = IVPSOLVE returns the handle to a new IVPSOLVE or the handle to
% the existing singleton*.
%
% IVPSOLVE('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in IVPSOLVE.M with the given input arguments.
%
% IVPSOLVE('Property','Value',...) creates a new IVPSOLVE or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before IVPsolve_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to IVPsolve_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 IVPsolve
% Last Modified by GUIDE v2.5 18-Jun-2009 17:07:46
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @IVPsolve_OpeningFcn, ...
'gui_OutputFcn', @IVPsolve_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 IVPsolve is made visible.
function IVPsolve_OpeningFcn(hObject, eventdata, handles, varargin)
global SETTINGS
% 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 IVPsolve (see VARARGIN)
% Choose default command line output for IVPsolve
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% out some picture on the buttons
set(handles.save, 'CData', imread('./pix/matlab.jpg'));
set(handles.pan , 'CData', imread('./pix/pan.jpg'));
set(handles.zoom, 'CData', imread('./pix/zoom.jpg'));
set(handles.legend, 'CData', imread('./pix/legend.jpg'));
set(handles.start, 'CData', imread('./pix/milch.jpg'));
set(handles.stab_button, 'CData', imread('./pix/button.jpg'));
set(handles.info, 'CData', imread('./pix/info_button_blue.jpg'));
set(handles.htmldocu, 'CData', imread('./pix/docu.jpg'));
set(handles.etaa,'Enable','Off');
set(handles.tolerance,'Enable','Off');
set(handles.eta,'ForegroundColor',[200 200 200]/255);
set(handles.tol,'ForegroundColor',[200 200 200]/255);
new_method='Herman';
old_method='Hesse';
do_stab=0; % this assures that if the programme starts, you have to run a calculation before you can analyse the region of stability
save data\do_stab.mat do_stab new_method -append
save data\do_stab_old_method.mat old_method
% region of stability for first method
load pix\stab_region_explizites-Eulerverfahren
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','Stabilittsgebiet des Verfahrens');
clear x_vec y_vec
% UIWAIT makes IVPsolve wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = IVPsolve_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;
function stepsize_Callback(hObject, eventdata, handles)
% hObject handle to stepsize (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 stepsize as text
% str2double(get(hObject,'String')) returns contents of stepsize as a double
% --- Executes during object creation, after setting all properties.
function stepsize_CreateFcn(hObject, eventdata, handles)
% hObject handle to stepsize (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 start.
function start_Callback(hObject, eventdata, handles)
global SETTINGS;
global RESULT;
tic
SETTINGS = get_SETTINGS(handles);
examples = get(handles.examples,'String');
example = examples(get(handles.examples,'Value'));
if strcmp(SETTINGS.method,'Milne-Simpson(4)') & strcmp(example,'example 4') & get(handles.step_cont,'Value')==1
errordlg('Milne-Simpson(4) with step control does not work for this IVP','error')
else
do_stab=1; % this is due, to realise a change of the method, when the region of stability is calculated
old_method = SETTINGS.method;
new_method = SETTINGS.method;
save data\do_stab.mat do_stab new_method -append
save data\do_stab_old_method.mat old_method
if get(handles.step_cont,'Value')==1 % step control or not
SETTINGS.tolerance=str2num(get(handles.tolerance,'String'));
SETTINGS.step_control=1;
[RESULT, SETTINGS] = ivp_solve(SETTINGS);
set(handles.stabilitaetsbereich,'String','calculated step sizes');
set(handles.stab_button,'String','open in Matlab window');
set(handles.etaa,'String',num2str(length(RESULT.steps)));
size1 = size(RESULT.gridpoints); % due to the exit condition forthe step_control loop
size2 = size(RESULT.steps); % different sizes can occur
gridpoints = RESULT.gridpoints;
steps = RESULT.steps;
if size1(2)~=size2(2)
if size1<size2
steps=steps(1:size1(2));
else
gridpoints=gridpoints(1:size2(2));
end
end
else
SETTINGS.step_control = 0;
set(handles.stab_button,'String','analiyse region of stability');
[RESULT, SETTINGS] = ivp_solve(SETTINGS);
end
%%%%%%%%%%%%%%% postprocessing %%%%%%%%%%%%%%%%%%%%%%%
cla(handles.solution_graphic)
axes(handles.solution_graphic);
if get(handles.exakt_solution_known,'Value')
% plot numerical and exact solution, if exact solution is known
plot(RESULT.gridpoints,RESULT.numerical_solution,RESULT.gridpoints,RESULT.exact_solution,'r');
[L2err,H1err,LI0err]= Error(SETTINGS.fu_exact,RESULT.gridpoints,RESULT.numerical_solution);
set(handles.l_inf_error,'String',num2str(LI0err));
set(handles.l_2_error,'String',num2str(L2err));
set(handles.h_1_error,'String',num2str(H1err));
else
% plot just numerical solution if exact solution is not known
plot(RESULT.gridpoints,RESULT.numerical_solution);
set(handles.l_inf_error,'String','');
set(handles.l_2_error,'String','');
set(handles.h_1_error,'String','');
end
legend('numerical solution','exact solution');
% just for user-defined methods we compute (and do not load) the region of stability
% this var is set in user_defined_method
if SETTINGS.calculate_region_of_stability == 1 && SETTINGS.step_control==0
cla(handles.region_of_stability)
if isfield(RESULT,'y')
set(handles.stabilitaetsbereich,'String','for these boundaries the region of stability is empty');
else
% plot region of stability
axes(handles.region_of_stability);
plot(RESULT.x,RESULT.y,'*');%'MarkerSize',0.1
set(handles.stabilitaetsbereich,'String','region of stability');
end
end
if SETTINGS.step_control==1
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(gridpoints,steps) %plots the step size for each grid point
end
disp_time=toc;
set(handles.time,'String',[num2str(disp_time),' sec']); % to display elapsed time
end
zoom on;
% hObject handle to start (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 Verfahren_inf.
function Verfahren_inf_Callback(hObject, eventdata, handles)
Informations;
% hObject handle to Verfahren_inf (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on selection change in methods.
function methods_Callback(hObject, eventdata, handles)
% hObject handle to methods (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
methods = get(handles.methods,'String');
actual_method=methods(get(handles.methods,'Value'));
new_method=actual_method; % this is due to realise a change of the method, when the region of stability is calculated
save data\do_stab.mat new_method -append
switch actual_method{1}
case 'Gau RKV'
load pix\stab_region_Gauss
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Adams-Bashforth(2)'
load pix\stab_region_Adams-Bashforth(2)
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Adams-Moulton(2)'
load pix\stab_region_Adams-Moulton(2)
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Milne-Simpson(4)'
load pix\stab_region_Milne-Simpson(4)
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','Stabilittsgebiet des Verfahrens');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Dormand-Prince RKV'
load pix\stab_region_'Dormand-Prince RKV'
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Adams-Bashforth(4)'
load pix\stab_region_'Adams-Bashforth(4)'
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'implicit Euler-method'
load pix\stab_region_implizites-Eulerverfahren
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Heun-Verfahren'
load pix\stab_region_Heun-Verfahren
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'BDF 5'
load pix\stab_region_BDF5
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'BDF 2'
load pix\stab_region_BDF2
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'explicit Euler-method'
load pix\stab_region_explizites-Eulerverfahren
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Radau II RKV'
load pix\stab_region_Radau-II-RKV
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Klassisches RKV'
load pix\stab_region_Klassisches-RKV
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'user defined method'
cla(handles.region_of_stability)
set(handles.stab_button,'String','analiyse region of stability');
end
% Hints: contents = get(hObject,'String') returns methods contents as cell
% array
% contents{get(hObject,'Value')} returns selected item from methods
% --- Executes during object creation, after setting all properties.
function methods_CreateFcn(hObject, eventdata, handles)
% hObject handle to methods (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox 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 selection change in examples.
function examples_Callback(hObject, eventdata, handles)
% hObject handle to examples (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns examples contents as cell array
% contents{get(hObject,'Value')} returns selected item from examples
examples = get(handles.examples,'String');
example = examples(get(handles.examples,'Value'));
switch char(example)
case 'example 1'
set(handles.equation,'String','x.^2.*exp(y)');
set(handles.beginvalue,'String','-4');
set(handles.endvalue,'String','4');
set(handles.startvalue,'String','-5');
set(handles.exakt_solution_known,'Value',1);
set(handles.exakt_solution_known,'Enable','On');
set(handles.u_exact,'String','-log(-(64/3)+exp(5)-1/3*x.^3)');
set(handles.tolerance,'String','0.01');
case 'example 2'
set(handles.equation,'String','20*sin(10*x)');
set(handles.beginvalue,'String','-5');
set(handles.endvalue,'String','-1');
set(handles.startvalue,'String','3');
set(handles.exakt_solution_known,'Value',1);
set(handles.exakt_solution_known,'Enable','On');
set(handles.u_exact,'String','-2*cos(10*x)+3+2*cos(-50)')
set(handles.tolerance,'String','0.07');
case 'example 3'
set(handles.equation,'String','y.*sin(x)+exp(-cos(x)).*x.^2');
set(handles.beginvalue,'String','-5/2*pi');
set(handles.endvalue,'String','3');
set(handles.startvalue,'String','1');
set(handles.exakt_solution_known,'Value',1);
set(handles.exakt_solution_known,'Enable','On');
set(handles.u_exact,'String','(1-1/3*(-5/2*pi)^3).*exp(-cos(x))+1/3*x.^3.*exp(-cos(x))')
set(handles.tolerance,'String','0.5');
case 'example 4'
set(handles.equation,'String','-20.*y+20.*cos(x)');
set(handles.beginvalue,'String','-5/2*pi');
set(handles.endvalue,'String','-1');
set(handles.startvalue,'String','1');
set(handles.exakt_solution_known,'Value',1);
set(handles.exakt_solution_known,'Enable','On');
set(handles.u_exact,'String','(1+20/401)*exp(-50*pi)*exp(-20*x)+400/401*cos(x)+20/401*sin(x)')
set(handles.tolerance,'String','0.01');
case 'example 5'
set(handles.equation,'String','(cos(y)).^2./sin(y).*x.*exp(1/2.*x)');
set(handles.beginvalue,'String','-5');
set(handles.endvalue,'String','4');
set(handles.startvalue,'String','pi/2-0.2626');
set(handles.exakt_solution_known,'Value',1);
set(handles.exakt_solution_known,'Enable','On');
set(handles.u_exact,'String','acos(1/(4*exp(1/2*x)*(1/2*x-1)+1/cos(pi/2-0.2626)*(14*exp(-5/2)*cos(pi/2-0.2626)+1)))');
set(handles.tolerance,'String','0.01');
case 'example 6'
set(handles.equation,'String','-4*cos(6*x).*y');
set(handles.beginvalue,'String','-6');
set(handles.endvalue,'String','0');
set(handles.startvalue,'String','-40');
set(handles.exakt_solution_known,'Value',1);
set(handles.exakt_solution_known,'Enable','On');
set(handles.u_exact,'String','(-40/exp(-2/3*sin(-36)))*exp(-2/3*sin(6*x))');
set(handles.tolerance,'String','0.5');
case 'example 7'
set(handles.equation,'String','-36.*exp(-36.*x)+exp(x).*(cos(exp(1.2*x))-1.2*exp(1.2*x).*sin(exp(1.2*x)))');
set(handles.beginvalue,'String','-0.125');
set(handles.endvalue,'String','4');
set(handles.startvalue,'String','exp(4.5)+exp(-0.125)*cos(exp(-0.15))');
set(handles.exakt_solution_known,'Value',1);
set(handles.exakt_solution_known,'Enable','On');
set(handles.u_exact,'String','exp(-36*x)+exp(x)*cos(exp(1.2*x));');
set(handles.tolerance,'String','0.7');
case 'own example'
set(handles.equation,'String','');
set(handles.beginvalue,'String','');
set(handles.endvalue,'String','');
set(handles.startvalue,'String','');
set(handles.tolerance,'String','0.1');
end
% --- Executes during object creation, after setting all properties.
function examples_CreateFcn(hObject, eventdata, handles)
% hObject handle to examples (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu 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 equation_Callback(hObject, eventdata, handles)
% hObject handle to equation (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 equation as text
% str2double(get(hObject,'String')) returns contents of equation as a double
% --- Executes during object creation, after setting all properties.
function equation_CreateFcn(hObject, eventdata, handles)
% hObject handle to equation (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 beginvalue_Callback(hObject, eventdata, handles)
% hObject handle to beginvalue (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 beginvalue as text
% str2double(get(hObject,'String')) returns contents of beginvalue as a double
% --- Executes during object creation, after setting all properties.
function beginvalue_CreateFcn(hObject, eventdata, handles)
% hObject handle to beginvalue (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 endvalue_Callback(hObject, eventdata, handles)
% hObject handle to endvalue (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 endvalue as text
% str2double(get(hObject,'String')) returns contents of endvalue as a double
% --- Executes during object creation, after setting all properties.
function endvalue_CreateFcn(hObject, eventdata, handles)
% hObject handle to endvalue (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 startvalue_Callback(hObject, eventdata, handles)
% hObject handle to startvalue (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 startvalue as text
% str2double(get(hObject,'String')) returns contents of startvalue as a double
% --- Executes during object creation, after setting all properties.
function startvalue_CreateFcn(hObject, eventdata, handles)
% hObject handle to startvalue (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 key press with focus on methods and none of its controls.
function methods_KeyPressFcn(hObject, eventdata, handles)
% hObject handle to methods (see GCBO)
% eventdata structure with the following fields (see UICONTROL)
% Key: name of the key that was pressed, in lower case
% Character: character interpretation of the key(s) that was pressed
% Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in exakt_solution_known.
function exakt_solution_known_Callback(hObject, eventdata, handles)
% hObject handle to exakt_solution_known (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if get(handles.exakt_solution_known,'Value')
set(handles.u_exact,'Enable','On');
set(handles.l_inf_error,'Enable','On');
set(handles.l_2_error,'Enable','On');
set(handles.h_1_error,'Enable','On');
set(handles.dy,'ForegroundColor','Black');
set(handles.l_inf_string,'ForegroundColor','Black');
set(handles.l_2_string,'ForegroundColor','Black');
set(handles.h_1_string,'ForegroundColor','Black');
else
set(handles.u_exact,'Enable','Off')
set(handles.l_inf_error,'Enable','Off');
set(handles.l_2_error,'Enable','Off');
set(handles.h_1_error,'Enable','Off');
set(handles.dy,'ForegroundColor',[200 200 200]/255);
set(handles.l_inf_string,'ForegroundColor',[200 200 200]/255);
set(handles.l_2_string,'ForegroundColor',[200 200 200]/255);
set(handles.h_1_string,'ForegroundColor',[200 200 200]/255);
end
% Hint: get(hObject,'Value') returns toggle state of exakt_solution_known
function u_exact_Callback(hObject, eventdata, handles)
% hObject handle to u_exact (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 u_exact as text
% str2double(get(hObject,'String')) returns contents of u_exact as a double
% --- Executes during object creation, after setting all properties.
function u_exact_CreateFcn(hObject, eventdata, handles)
% hObject handle to u_exact (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 Datei_Callback(hObject, eventdata, handles)
% hObject handle to Datei (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function new_Callback(hObject, eventdata, handles)
% hObject handle to new (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
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)
% --- Executes on button press in info.
function info_Callback(hObject, eventdata, handles)
% hObject handle to info (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
open('data\general informations.pdf');
% --- Executes on button press in pan.
function pan_Callback(hObject, eventdata, handles)
% hObject handle to pan (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
pan on;
% --- Executes on button press in zoom.
function zoom_Callback(hObject, eventdata, handles)
% hObject handle to zoom (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
zoom on;
% --- Executes on button press in save.
function save_Callback(hObject, eventdata, handles)
% hObject handle to save (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global RESULT;
f1 = figure;
scrsz = get(0,'ScreenSize');
set(f1,'Position',0.75*scrsz);
if get(handles.exakt_solution_known,'Value')
plot(RESULT.gridpoints,RESULT.numerical_solution,RESULT.gridpoints,RESULT.exact_solution,'r');
else
plot(RESULT.gridpoints,RESULT.numerical_solution);
end
legend('nummersiche Lsung','exakte Lsung');
% --- Executes during object creation, after setting all properties.
function save_CreateFcn(hObject, eventdata, handles)
% hObject handle to save (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 legend.
function legend_Callback(hObject, eventdata, handles)
if get(handles.legend,'UserData')
legend (handles.solution_graphic, 'hide');
set(handles.legend,'UserData',0);
else
legend (handles.solution_graphic, 'show');
set(handles.legend,'UserData',1);
end
% hObject handle to legend (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 stab_button.
function stab_button_Callback(hObject, eventdata, handles)
global SETTINGS RESULT
load data\do_stab.mat
load data\do_stab_old_method.mat
if do_stab==1 & strcmp(new_method,old_method)& SETTINGS.step_control==0
region_of_stability(SETTINGS);
elseif SETTINGS.step_control==1 & strcmp(new_method,old_method)
size1=size(RESULT.gridpoints); % due to the exit condition forthe step_control loop
size2=size(RESULT.steps); % different sizes can occur
gridpoints=RESULT.gridpoints;
steps=RESULT.steps;
if size1(2)~=size2(2)
if size1<size2
steps=steps(1:size1(2));
else
gridpoints=gridpoints(1:size2(2));
end
end
figure
plot(gridpoints,steps)
else
errordlg('Please start a new calculation first! ','error')
end
% hObject handle to stab_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function l_inf_error_Callback(hObject, eventdata, handles)
% hObject handle to l_inf_error (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 l_inf_error as text
% str2double(get(hObject,'String')) returns contents of l_inf_error as a double
% --- Executes during object creation, after setting all properties.
function l_inf_error_CreateFcn(hObject, eventdata, handles)
% hObject handle to l_inf_error (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 l_2_error_Callback(hObject, eventdata, handles)
% hObject handle to l_2_error (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 l_2_error as text
% str2double(get(hObject,'String')) returns contents of l_2_error as a double
% --- Executes during object creation, after setting all properties.
function l_2_error_CreateFcn(hObject, eventdata, handles)
% hObject handle to l_2_error (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 h_1_error_Callback(hObject, eventdata, handles)
% hObject handle to h_1_error (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 h_1_error as text
% str2double(get(hObject,'String')) returns contents of h_1_error as a double
% --- Executes during object creation, after setting all properties.
function h_1_error_CreateFcn(hObject, eventdata, handles)
% hObject handle to h_1_error (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 step_cont.
function step_cont_Callback(hObject, eventdata, handles)
% hObject handle to step_cont (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of step_cont
if get(handles.step_cont,'Value')
set(handles.tolerance,'Enable','On');
set(handles.etaa,'Enable','On');
set(handles.tol,'ForegroundColor','Black');
set(handles.eta,'ForegroundColor','Black');
set(handles.stepsize,'Enable','Off');
else
set(handles.etaa,'Enable','Off');
set(handles.tolerance,'Enable','Off');
set(handles.eta,'ForegroundColor',[200 200 200]/255);
set(handles.tol,'ForegroundColor',[200 200 200]/255);
set(handles.stepsize,'Enable','On');
verfahren = get(handles.methods,'String');
actual_method=verfahren(get(handles.methods,'Value'));
switch actual_method{1}
case 'Gau RKV'
load pix\stab_region_Gauss
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Adams-Bashforth(2)'
load pix\stab_region_Adams-Bashforth(2)
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Adams-Moulton(2)'
load pix\stab_region_Adams-Moulton(2)
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Milne-Simpson(4)'
load pix\stab_region_Milne-Simpson(4)
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','Stabilittsgebiet des Verfahrens');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Dormand-Prince RKV'
load pix\stab_region_'Dormand-Prince RKV'
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Adams-Bashforth(4)'
load pix\stab_region_'Adams-Bashforth(4)'
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'implicit Euler-method'
load pix\stab_region_implizites-Eulerverfahren
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Heun-Verfahren'
load pix\stab_region_Heun-Verfahren
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'BDF 5'
load pix\stab_region_BDF5
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'BDF 2'
load pix\stab_region_BDF2
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'explicit Euler-method'
load pix\stab_region_explizites-Eulerverfahren
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Radau II RKV'
load pix\stab_region_Radau-II-RKV
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'Klassisches RKV'
load pix\stab_region_Klassisches-RKV
cla(handles.region_of_stability)
axes(handles.region_of_stability);
plot(x_vec,y_vec,'.')
set(handles.stabilitaetsbereich,'String','region of stability');
set(handles.stab_button,'String','analiyse region of stability');
clear x_vec y_vec
case 'user defined method'
cla(handles.region_of_stability)
set(handles.stab_button,'String','analiyse region of stability');
end
end
function tolerance_Callback(hObject, eventdata, handles)
% hObject handle to tolerance (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 tolerance as text
% str2double(get(hObject,'String')) returns contents of tolerance as a double
% --- Executes during object creation, after setting all properties.
function tolerance_CreateFcn(hObject, eventdata, handles)
% hObject handle to tolerance (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 etaa_Callback(hObject, eventdata, handles)
% hObject handle to etaa (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 etaa as text
% str2double(get(hObject,'String')) returns contents of etaa as a double
% --- Executes during object creation, after setting all properties.
function etaa_CreateFcn(hObject, eventdata, handles)
% hObject handle to etaa (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 during object creation, after setting all properties.
function step_cont_CreateFcn(hObject, eventdata, handles)
% hObject handle to step_cont (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
function time_Callback(hObject, eventdata, handles)
% hObject handle to time (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 time as text
% str2double(get(hObject,'String')) returns contents of time as a double
% --- Executes during object creation, after setting all properties.
function time_CreateFcn(hObject, eventdata, handles)
% hObject handle to time (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 htmldocu.
function htmldocu_Callback(hObject, eventdata, handles)
% hObject handle to htmldocu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
open('doc\index.html')