📄 fft_param.m
字号:
% fft_param.m% Setup gui parameters:% ttlbarcorrects vertical spacing by adjusting for title bar height. ttlbar = [0 75 0 0]; rowheight = [0 25 0 0]; % The vertical space required for a control (20 + 5) guifigsize = [20 scrn(4)-350 350 375]-ttlbar; guifigy = guifigsize(4)-20; %%% Resize window set(guifig,'position',guifigsize); % set "first" control positions a1size = [0 guifigsize(4)-65 floor(1/2*guifigsize(3)) 20]; b1size = [a1size(3)+3 guifigsize(4)-65 floor(1/6*guifigsize(3)) 20];% set data_name and data_size control positions % datasetuppos positions the text that reflects the current data set% datasizepos positions the text that reflects the current data set size (n by n) datasetuppos = [0 guifigy 2/3*guifigsize(3) 20]; datasizepos = [datasetuppos(3) guifigy 1/3*guifigsize(3) 20];% Set default parameter values% Initialize and set default stopping tolerances. cg_maxiter = 10; cg_steptol = 1e-4; cg_residtol = 1e-4; cg_tab_flag = 1; bh = Kstarz * (hx*hy); alpha = 1e-8; option = 0; q = 0; % Setup the Graphic Controls for FFT/PCG methodeval(hideall);set(ui_a16, ... 'style','text', ... 'string',datasetupflag, ... 'position',datasetuppos, ... 'backgroundcolor',bgcolor, ... 'foregroundcolor',[0 0 0], ... 'visible','on');set(ui_b16, ... 'string',[num2str(max(size(z))), ' by ', num2str(max(size(z))) ], ... 'style','text', ... 'position',datasizepos, ... 'backgroundcolor',bgcolor, ... 'foregroundcolor',[0 0 0], ... 'visible','on');% controls for parameter alphaset(ui_a1, ... 'backgroundcolor',bgcolor,... 'foregroundcolor',[1 1 1], ... 'style','text',... 'horizontalalignment','right',... 'string','Reg param alpha =',... 'position',a1size, ... 'visible','on');ui_b1_action = ['alpha=str2num(get(ui_b1,''string''));'];set(ui_b1, ... 'position',b1size, ... 'backgroundcolor',[1 1 1],... 'style','edit',... 'string',num2str(alpha),... 'callback',ui_b1_action,... 'visible','on');% controls for parameter Regularization order qset(ui_a2, ... 'backgroundcolor',bgcolor, ... 'foregroundcolor',[1 1 1], ... 'style','text',... 'string','Regularization order q', ... 'horizontalalignment','right',... 'position',a1size-rowheight, ... 'visible','on');q_action = ['qm = get(ui_b2,''value'');' , ... 'if qm==1,' , ... 'q = 0;' , ... 'else,' , ... 'q = 1;' , ... 'end'];set(ui_b2, ... 'backgroundcolor',[1 1 1], ... 'foregroundcolor',[0 0 0], ... 'style','popupmenu',... 'string','0|1', ... 'horizontalalignment','center',... 'position',b1size-rowheight, ... 'callback',q_action,... 'value',0,... 'visible','on');% control for PCG optionset(ui_a3, ... 'backgroundcolor',bgcolor,... 'foregroundcolor',[1 1 1], ... 'style','text',... 'horizontalalignment','right',... 'string','PCG option',... 'position',a1size-2*rowheight, ... 'visible','on');pcg_action = ... ['option=get(ui_b3,''value'');', ... 'if (option==0),' , ... 'set(ui_a4,''visible'',''off''),' , ... 'set(ui_a5,''visible'',''off''),' , ... 'set(ui_a6,''visible'',''off''),' , ... 'set(ui_b4,''visible'',''off''),' , ... 'set(ui_b5,''visible'',''off''),' , ... 'set(ui_b6,''visible'',''off''),' , ... 'else,' , ... 'set(ui_a4,''visible'',''on''),' , ... 'set(ui_a5,''visible'',''on''),' , ... 'set(ui_a6,''visible'',''on''),' , ... 'set(ui_b4,''visible'',''on''),' , ... 'set(ui_b5,''visible'',''on''),' , ... 'set(ui_b6,''visible'',''on''),' , ... 'end'];set(ui_b3, ... 'position',[b1size(1) b1size(2)-2*rowheight(2) 18 18], ... 'backgroundcolor',[1 1 1],... 'style','radio',... 'callback',pcg_action,... 'value',0, ... 'visible','on');% controls for parameter cg_maxiterset(ui_a4, ... 'backgroundcolor',bgcolor, ... 'foregroundcolor',[1 1 1], ... 'style','text',... 'string','cg max iter', ... 'horizontalalignment','right',... 'position',a1size-3*rowheight, ... 'visible','off');cgmaxiter_action = ['cg_maxiter=str2num(get(ui_b4,''string''));'];set(ui_b4, ... 'backgroundcolor',[1 1 1], ... 'foregroundcolor',[0 0 0], ... 'style','edit',... 'string',num2str(cg_maxiter), ... 'horizontalalignment','right',... 'position',b1size-3*rowheight, ... 'callback',cgmaxiter_action,... 'visible','off');% controls for parameter cg_steptolset(ui_a5, ... 'backgroundcolor',bgcolor, ... 'foregroundcolor',[1 1 1], ... 'style','text',... 'string','cg step tol', ... 'horizontalalignment','right',... 'position',a1size-4*rowheight, ... 'visible','off');cgsteptol_action = ['cg_steptol=str2num(get(ui_b5,''string''));'];set(ui_b5, ... 'backgroundcolor',[1 1 1], ... 'foregroundcolor',[0 0 0], ... 'style','edit',... 'string',num2str(cg_steptol), ... 'horizontalalignment','right',... 'position',b1size-4*rowheight, ... 'callback',cgsteptol_action,... 'visible','off');% controls for parameter cg_residtolset(ui_a6, ... 'backgroundcolor',bgcolor, ... 'foregroundcolor',[1 1 1], ... 'style','text',... 'string','cg resid tol', ... 'horizontalalignment','right',... 'position',a1size-5*rowheight, ... 'visible','off');cgresidtol_action = ['cg_residtol=str2num(get(ui_b6,''string''));'];set(ui_b6, ... 'backgroundcolor',[1 1 1], ... 'foregroundcolor',[0 0 0], ... 'style','edit',... 'string',num2str(cg_residtol), ... 'horizontalalignment','right',... 'position',b1size-5*rowheight, ... 'callback',cgresidtol_action,... 'visible','off');frbgcolor = [1 1 1];set(ui_frame_r, 'position',[guifigsize(3)-110 210 106 120], ... 'backgroundcolor',frbgcolor,... 'style','frame',... 'visible','on');% other controls are placed relative to the exitbtn% Thus, we define the exitbtnpos here.exitbtnpos = [guifigsize(3)-105 5 95 20];cg_tab_text_size = [guifigsize(3)-105 5 60 20]+7*rowheight;cg_tab_radio_size = [guifigsize(3)-45 5 18 18]+7*rowheight;%Text label "Tabular Output"set(ui_a17, ... 'backgroundcolor',frbgcolor,... 'foregroundcolor',bgcolor, ... 'style','text',... 'horizontalalignment','center',... 'string','Tabular Output', ... 'position',exitbtnpos+12*rowheight, ... 'visible','on');% controls for parameter cg_tab (cg tabular output on or off)set(ui_a18, ... 'backgroundcolor',frbgcolor,... 'foregroundcolor',[0 0 0], ... 'style','text',... 'horizontalalignment','right',... 'string','CG ', ... 'position',cg_tab_text_size+4*rowheight, ... 'visible','on');cg_tab_action = ... ['if get(ui_b18,''value'')==1,'... 'cg_tab_flag=1;' ... 'else,' ... 'cg_tab_flag=0;' ... 'end'];set(ui_b18, ... 'position',cg_tab_radio_size+4*rowheight, ... 'backgroundcolor',frbgcolor,... 'style','checkbox',... 'callback',cg_tab_action,... 'value',1, ... 'visible','on');% buttons run/break/closeuirunbtn_action = ['lastfig = max(findobj(''type'', ''figure''));' , ... 'if (option==1),' , ... 'if ( figure_list(5) > 0 ),' , ... 'cg_fig = figure_list(5);' , ... 'else,' , ... 'cg_fig = lastfig + 1;' , ... 'figure_list(5) = cg_fig;' , ... 'end,' , ... 'else,' , ... 'if ( figure_list(6) > 0 ),' , ... 'fft_fig = figure_list(6);' , ... 'else,' , ... 'fft_fig = lastfig + 1;' , ... 'figure_list(6) = fft_fig;' , ... 'end,' , ... 'end,' , ... 'set(uirunbtn,''string'',''Working''),',... 'set(uirunbtn,''backgroundcolor'',[1 .5 0]),', ... 'fft_driver,', ... 'set(uirunbtn,''backgroundcolor'',green),', ... 'set(uirunbtn,''string'',''Run FFT'')'];set(uirunbtn, ... 'position', exitbtnpos+2*rowheight, ... 'callback',uirunbtn_action, ... 'string','Run FFT', ... 'backgroundcolor',green, ... 'visible','on');set(uibreakbtn, ... 'visible','on', ... 'callback','fft_param,dbquit', ... 'position',exitbtnpos+rowheight);set(uiexitbtn, ... 'pos', exitbtnpos, ... 'visible','on');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -