Code covered by the BSD License  

Highlights from
Program to Solve initial value problems by various methods

image thumbnail
from Program to Solve initial value problems by various methods by Daniel Klawitter
initial value problem solver enter >>IVPsolve to start

get_SETTINGS(handles)
function SETTINGS = get_SETTINGS(handles)
% function to fetch some information from the gui, as input parameter for
% the function ivp_solve
%
% input:   o handles...object hanles from the main GUI
%
% output:  o SETTINGS...struct with parameters for the solve function
%
% notes:   o
%
% authors: o Christian Jkel (University of Technology Dresden)
%          o Daniel Klawitter (University of Technology Dresden)

SETTINGS.step = str2double(get(handles.stepsize,'String'));
% select method from listbox
methods = get(handles.methods,'String');
SETTINGS.method = methods(get(handles.methods,'Value'));
SETTINGS.calculate_region_of_stability = 0; % region of stability won't be calculated

% set function from string as function handle
eval(['SETTINGS.equation = @(x,y)',get(handles.equation,'String'),';']);
if get(handles.exakt_solution_known,'Value')
    eval(['SETTINGS.fu_exact = @(x)',get(handles.u_exact,'String'),';']);
end
% startpoint of the interval
SETTINGS.beginvalue = str2num(get(handles.beginvalue,'String'));
% endpoint of the intervall
SETTINGS.endvalue = str2num(get(handles.endvalue,'String'));
% startvalue for the ODE
SETTINGS.startvalue = str2num(get(handles.startvalue,'String'));

% Runge-Kutta-method or linear multistep method?
switch char(SETTINGS.method)
    case {'explicit Euler-method','Heun-Verfahren','Klassisches RKV','Dormand-Prince RKV','implicit Euler-method','Radau II RKV','Gau RKV','eigenesRKV'}
        SETTINGS.isRKV = 1;
    otherwise
        SETTINGS.isRKV = 0;
end

if strcmp(SETTINGS.method,'user defined method')
    % region of stability will be calculated
    SETTINGS.calculate_region_of_stability = 1; 
    
%     RESULT_USER_DEFINED_METHOD = user_defined_method;
    SETTINGS = user_defined_method(SETTINGS);   
    
    if SETTINGS.isRKV
        method_for_region_of_stability = 'eigenesRKV';
        stab_a = SETTINGS.c;
        stab_c = SETTINGS.B;
        stab_B = SETTINGS.a;
    else
        stab_rho = SETTINGS.rho;
        stab_sigma = SETTINGS.sigma;
        method_for_region_of_stability = 'eigenesMSV';
    end
end

Contact us at files@mathworks.com