% visn.m % % VIS The program for visualization of radial function. % The function is created symbolically. % Finally its graph is shown in a window. The user % has a possibility for controlling function parameters % interactively. % Some notes: I use first two MATLAB windows (Figure #1 % and Figure #2). If there are any open windows when the % program is using, they will remain untouched. % n and l given unphysical values, range initialized. n=-1;l=-1;range=30; nold=n;lold=l; % An array of numbers starting from 0 to range with step of range/100 % These are the points at which the function is evaluated. % This array is used later on for graphs. n=1; l=0; x=0:range/100:range; % Open graph window #1 F1=figure; % Open control window #2 with sliders F2=figure; % Resizing the control window pos=get(F2,'position'); pos(3)=300;pos(4)=250; % dimensions of the command window; set(F2,'position',pos); % Main Control Functions: Title, exit, type of displaying. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TitleF= uicontrol('style','text', ... 'string','Controls for Wavefunction Tool', ... 'position', [10 225 275 20]); ExitBut=uicontrol('style','pushbutton',... 'string','EXIT','position', [10 200 50 20],... 'callback','close(F1);close(F2);'); Rmulv=-1; Rst=['Change to r*R(r)';' Change to R(r) ']; Rmul=uicontrol('style','pushbutton',... 'string','Change to r*R(r)','position', [10 175 150 20],... 'callback',... 'Rmulv=-Rmulv;nold=-1;updater;set(Rmul,''string'',Rst(fix(1.6+Rmulv/2),:));'); % Control of Paramter 'n' %%%%%%%%%%%%%%%%%%%%%%%%%% % Text field with value of 'n' n_text = uicontrol('style','text', ... 'string','n=', 'position',[10 20 80 20]); % Callback for n_slide (updates value of 'n' in the text-field % and redraws the graph; it is contained in script file updaten.m n_slide = uicontrol('style','slider', ... 'min',0,'max',10.0, ... 'position',[100 20 160 20], ... 'value',n, ... 'callback',['n=get(n_slide,''value'');updaten;']); % Control of Paramter 'l' %%%%%%%%%%%%%%%%%%%%%%%%%% % Text field with value of 'l' l_text = uicontrol('style','text', ... 'string','l=', 'position',[10 60 80 20]); % Callback for n_slide (updates value of 'n' in the text-field % and redraws the graph % The actual slider control l_slide = uicontrol('style','slider', ... 'min',0,'max',10.0, ... 'position',[100 60 160 20], ... 'value',l, ... 'callback',['l=get(l_slide,''value'');updatel;']); % Parameter 'range' %%%%%%%%%%%%%%%%%%%% % Text field with value of 'range' r_text = uicontrol('style','text', ... 'string','range=', 'position',[10 100 80 20]); % Callback for r_slide (updates value of 'range' in the text-field % and redraws the graph %updater='eval(update_graph);set(r_text,''string'',[''range='' num2str(range)]);'; % The actual slider control r_slide = uicontrol('style','slider', ... 'min',0,'max',200, ... 'position',[100 100 160 20], ... 'value',range, ... 'callback',['range=get(r_slide,''value'');updater;']); % Parameter 'Evaluating...' %%%%%%%%%%%%%%%%%%%%%%%%%%% % The following code does not work with some Matlab versions. If you have such % problem try to use a different version of it. figure(F1); mess1=uicontrol('style','edit', ... 'string','Evaluating the symbolics ..........', ... 'BackgroundColor','red',... 'ForegroundColor','white',... 'position',[10 200 300 20], 'visible','off'); drawnow; % Leaves the control window on top figure(F2);