📄 setting.m
字号:
function setting(action)%SETTING GUI window for users to input parameters%% See also: LET, README, SETHELP, LETHELP, STARTLET% by Steve W. K. SIU, July 5, 1998.if nargin<1 action='initilization'; %Obtain the handles of all GUI components of %the main window for later use MainHandles=get(gcf,'UserData');else %Get the handles of GUI components of %the Setting window. HandlesList=get(gcf,'UserData');endaction=lower(action);switch actioncase 'initilization' %Font Size FontSize=8; %%%%%%%%%%%%%%%%%%%%%%%%%% %% INITIALIZATION %%%%%%%%%%%%%%%%%%%%%%%%%% %Restore the (default) DATA DATA=get(MainHandles(4),'UserData'); %Create a GUI Setting Window %Before creating the setting window, get current axes' handles AxesHandle=gca; %Get the data stored in 'UserData' of the "Setting" button %MainHandles(4) is the handle of "Setting" button DATA=get(MainHandles(4),'UserData'); %Get the output file and ODE function names stored in %'UserData' of the "Start" button. %MainHandles(2) is the handle of "Start" button NAMES=get(MainHandles(2),'UserData'); OutputFile=rmspace(NAMES(1,:)); odeFunction=rmspace(NAMES(2,:)); %%%%%%%%%%%%%%%%%%%%%%%%%%% % Setting Window %%%%%%%%%%%%%%%%%%%%%%%%%%% a=figure('Units','Normalized','Color',[0.513725 0.6 0.694118], ... 'Name','Setting','NumberTitle','off',... 'Position',[0.085 0.065 0.85 0.8],'MenuBar','None', ... 'Resize','on','Visible','Off','Tag','Fig1'); %Label: "OUTPUT OPTIONS" uicontrol('Parent',a,'Units','normalized','Tag','StaticText10',... 'HorizontalAlignment','left',... 'BackgroundColor',[0.513725 0.6 0.694118],'String','OUTPUT OPTIONS',... 'FontSize', FontSize,'FontWeight','bold','Style','text',... 'Position',[0.05 0.9 0.3 0.04]); %Check box for "Output File" opChk=uicontrol('Parent',a,'Units','normalized','Tag','Checkbox1', ... 'HorizontalAlignment','left',... 'BackgroundColor',[0.513725 0.6 0.694118],'FontSize', FontSize, ... 'Position',[0.05 0.84 0.15 0.0527859],... 'String','Output File :','Style','checkbox','Value',DATA(1)); %Edit box for "Output File" opEdt=uicontrol('Parent',a,'Units','normalized','Tag','EditText8',... 'BackgroundColor',[1 1 1],'ForegroundColor',[0 0 1],'Style','edit', ... 'Position',[0.2 0.84 0.234 0.0557185],'FontSize', FontSize,'String',OutputFile); %Label: "Precision" uicontrol('Parent',a,'Units','normalized', ... 'BackgroundColor',[0.513725 0.6 0.694118], ... 'FontSize', FontSize,'Position',[0.28 0.78 0.12 0.04], ... 'String','Precision','Style','text','Tag','StaticText11'); %Check box for "Lyapunov Exponents" leChk=uicontrol('Parent',a,'Units','normalized', ... 'BackgroundColor',[0.513725 0.6 0.694118],'Tag','Checkbox2', ... 'HorizontalAlignment','left',... 'FontSize', FontSize,'Position',[0.05 0.71261 0.226415 0.058651], ... 'String','Lyapunov Exponents','Style','checkbox','Value',DATA(2)); %Check box for "Lyapunov Dimension" ldChk=uicontrol('Parent',a,'Units','normalized','Tag','Checkbox3', ... 'BackgroundColor',[0.513725 0.6 0.694118],'FontSize', FontSize, ... 'HorizontalAlignment','left',... 'Position',[0.05 0.648094 0.226415 0.058651], ... 'String','Lyapunov Dimension','Style','checkbox','Value',DATA(4)); %Pop-up menu for precision of "Lyapunov Exponents" lePop=uicontrol('Parent',a,'Units','normalized', ... 'BackgroundColor',[1 1 1],'ForegroundColor',[0 0 1], ... 'Position',[0.285 0.715543 0.115 0.058651],'FontSize', FontSize, ... 'String',char('%.4f','%.6f','%.8f','%.10f','%.12f'), ... 'Style','popupmenu','Tag','PopupMenu2','Value',DATA(3)); %Pop-up menu for precision of Lyapunov dimension ldPop=uicontrol('Parent',a,'Units','normalized', ... 'BackgroundColor',[1 1 1],'ForegroundColor',[0 0 1], ... 'Position',[0.285 0.65 0.115 0.058],'FontSize', FontSize, ... 'String',char('%.4f','%.6f','%.8f','%.10f','%.12f'), ... 'Style','popupmenu','Tag','PopupMenu3','Value',DATA(5)); %Label: "INTEGRATION PARAMETERS" uicontrol('Parent',a,'Units','normalized','FontSize', FontSize,... 'BackgroundColor',[0.513725 0.6 0.694118],'FontWeight','bold',... 'HorizontalAlignment','left',... 'Position',[0.05 0.557185 0.333962 0.04],'Style','text',... 'String','INTEGRATION PARAMETERS','Tag','StaticText1'); %Label: "ODE Function" uicontrol('Parent',a,'Units','normalized','FontSize', FontSize,... 'BackgroundColor',[0.513725 0.6 0.694118],'Style','text',... 'HorizontalAlignment','left',... 'Position',[0.05 0.5 0.15 0.04],... 'String','ODE Function :','Tag','StaticText2'); %Label: "Integration Method" uicontrol('Parent',a,'Units','normalized','FontSize', FontSize, ... 'BackgroundColor',[0.513725 0.6 0.694118],'Style','text',... 'Position',[0.05 0.44 0.186 0.04],... 'HorizontalAlignment','left',... 'String','Integration Method :','Tag','StaticText3'); %Label: "Initial Time" uicontrol('Parent',a,'Units','normalized','FontSize', FontSize,... 'BackgroundColor',[0.513725 0.6 0.694118],'Style','text',... 'HorizontalAlignment','left',... 'Position',[0.05 0.377 0.115 0.04], ... 'String','Initial Time :','Tag','StaticText4'); %Label: "Final Time" uicontrol('Parent',a,'Units','normalized','FontSize', FontSize,... 'BackgroundColor',[0.513725 0.6 0.694118],'Style','text',... 'HorizontalAlignment','left',... 'Position',[0.05 0.32 0.113 0.04], ... 'String','Final Time :','Tag','StaticText5'); %Label "Time Step" uicontrol('Parent',a,'Units','normalized','FontSize', FontSize,... 'BackgroundColor',[0.513725 0.6 0.694118],'Style','text',... 'HorizontalAlignment','left',... 'Position',[0.05 0.27 0.11 0.04], ... 'String','Time Step :','Tag','StaticText6'); %Label: "Relative Tolerance" uicontrol('Parent',a,'Style','text','Units','normalized','FontSize', FontSize, ... 'HorizontalAlignment','left',... 'BackgroundColor',[0.513725 0.6 0.694118],'String','Relative Tolerance :', ... 'Position',[0.05 0.21 0.18 0.04],'Tag','StaticText7'); %Label: "Absolution Tolerance" uicontrol('Parent',a,'Units','normalized','FontSize', FontSize,... 'BackgroundColor',[0.513725 0.6 0.694118],'Style','text',... 'HorizontalAlignment','left',... 'String','Absolute Tolerance :','Tag','StaticText8',... 'Position',[0.05 0.154 0.18 0.04]); %Label: "Initial Conditions" uicontrol('Parent',a,'Units','normalized','FontSize', FontSize,... 'BackgroundColor',[0.513725 0.6 0.694118],'Style','text',... 'HorizontalAlignment','left',... 'Position',[0.05 0.095 0.18 0.04],... 'String','Initial Condition(s) :','Tag','StaticText9'); %Edit box for "ODE Function" odeEdt=uicontrol('Parent',a,'Units','normalized','Style','edit',... 'BackgroundColor',[1 1 1],'ForegroundColor',[0 0 1],'Tag','EditText2', ... 'Position',[0.2 0.5 0.2 0.055],'FontSize', FontSize,'String',odeFunction); %Edit box for "Final Time" ftEdt=uicontrol('Parent',a,'Units','normalized','Tag','EditText4','FontSize', FontSize, ... 'BackgroundColor',[1 1 1],'ForegroundColor',[0 0 1],'Style','edit',... 'Position',[0.166 0.325513 0.234 0.05],'String',num2str(DATA(8))); %Edit box for "Time Step" tsEdt=uicontrol('Parent',a,'Units','normalized','Tag','EditText5','FontSize', FontSize, ... 'BackgroundColor',[1 1 1],'ForegroundColor',[0 0 1],'Style','edit', ... 'Position',[0.166 0.272727 0.234 0.05],'String',num2str(DATA(9))); %Edit box for "Relative Tolerance" rtolEdt=uicontrol('Parent',a,'Units','normalized','Tag','EditText6','FontSize', FontSize,... 'BackgroundColor',[1 1 1],'ForegroundColor',[0 0 1],'Style','edit',... 'Position',[0.25 0.214076 0.15 0.05],'String',num2str(DATA(10))); %Edit box for "Absolute Tolerance" atolEdt=uicontrol('Parent',a,'Units','normalized','Tag','EditText7','FontSize', FontSize,... 'BackgroundColor',[1 1 1],'ForegroundColor',[0 0 1],'Style','edit',... 'Position',[0.25 0.158358 0.15 0.05],'String',num2str(DATA(11))); %Pop-up menu for "Integration method" Methods=char('Discrete map', 'ODE45','ODE23','ODE113','ODE23S','ODE15S'); intPop=uicontrol('Parent',a,'Units','normalized','FontSize', FontSize,... 'BackgroundColor',[1 1 1],'ForegroundColor',[0 0 1],'Value',DATA(6),... 'Position',[0.25 0.43 0.15 0.0557185],'Tag','PopupMenu1',... 'String',Methods,'Style','popupmenu',... 'callback','setting(''changeMethod'')'); %Edit box for "Initial Time" itEdt=uicontrol('Parent',a,'Units','normalized','Tag','EditText3','FontSize', FontSize,... 'BackgroundColor',[1 1 1],'ForegroundColor',[0 0 1],'Style','edit',... 'Position',[0.166 0.381232 0.234 0.05],'String',num2str(DATA(7))); %Edit Box for "Initial Coniditions" if length(DATA)>=19 icStr=num2str(DATA(19:length(DATA))); else icStr=''; end icEdt=uicontrol('Parent',a,'Units','normalized','Tag','EditText1',... 'BackgroundColor',[1 1 1],'ForegroundColor',[0 0 1],'Style','edit',... 'Position',[0.25 0.1 0.74 0.055],'String',icStr,'FontSize', FontSize); %Label: "PLOTTING OPTIONS" uicontrol('Parent',a,'Units','normalized','Tag','StaticText12',... 'BackgroundColor',[0.513725 0.6 0.694118],'Style','text',... 'FontWeight','bold','String','PLOTTING OPTIONS',... 'HorizontalAlignment','left',... 'Position',[0.5 0.909091 0.24 0.0498534],'FontSize', FontSize); %Radio button: "Update the plot imediately" PlotImedRadio=uicontrol('Parent',a,'Units','normalized', ... 'BackgroundColor',[0.513725 0.6 0.694118], ... 'FontSize', FontSize,'Position',[0.5 0.835777 0.28 0.058], ... 'HorizontalAlignment','left',... 'String','Update the plot immediately','Callback','setting(1)', ... 'Style','radiobutton','Tag','Radiobutton1','Value',DATA(12)); %Radio button: "Update the plot every" PlotStepRadio=uicontrol('Parent',a,'Units','normalized', ... 'BackgroundColor',[0.513725 0.6 0.694118],'FontSize', FontSize,... 'Position',[0.5 0.75 0.23 0.058],'Value',DATA(13),... 'HorizontalAlignment','left',... 'String','Update the plot every','Callback','setting(2)',... 'Style','radiobutton','Tag','Radiobutton2'); %Edit box: no. of iterations for updating the plot PlotStepEdt=uicontrol('Parent',a,'Units','normalized','FontSize', FontSize,... 'BackgroundColor',[1 1 1],'ForegroundColor',[0 0 1], ... 'Position',[0.74 0.75 0.1 0.052],'String',num2str(DATA(14)),... 'Style','Edit','Tag','EditText15'); %Label: "iterations" uicontrol('Parent',a,'Units','normalized','FontSize', FontSize,'Style','text',... 'BackgroundColor',[0.513725 0.6 0.694118],'String','iterations',... 'HorizontalAlignment','left',... 'Position',[0.87 0.73 0.12 0.058],'Tag','StaticText22'); %Label: "Line Color" uicontrol('Parent',a,'Units','normalized','FontSize', FontSize,'Tag','StaticText16',... 'BackgroundColor',[0.513725 0.6 0.694118],'Style','text', ... 'HorizontalAlignment','left',... 'Position',[0.5 0.65 0.12 0.0498534],'String','Line Color :'); %HandlesList(19) is the handle of "Line Color" pop-up menu c=DATA(15); %Look-up tables for background and foreground colors Back='bkgrymc'; Fore='wwkwkwk'; Background=Back(c);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -