📄 demo3.m
字号:
%DEMO3 MGLab Truncation Error Demo
%
% This demo solves the Poisson problem on
% different grids.
%
% In each case, the relative truncation (pde)
% error, and the relative residual are plotted
% as functions of the iteration count.
%
% The intention is to demonstrate that multigrid
% achieves truncation error accuracy quickly
% and can reduce the discrete residual down to
% very small tolerences.
%
% The PDE error (correct digits) and the average
% residual reduction per iteration are also shown
%
% Accesses global variables in "demo_globals"
% James Bordner and Faisal Saied
% Department of Computer Science
% University of Illinois at Urbana-Champaign
% 10 April 1995
function demo3_uic_continue = demo3_info
%
%
%
demo_globals
page=[ ' ';...
' Demo 3 ';...
' ';...
' This demo solves the Poisson problem on ';...
' different grids. ';...
' ';...
' In each case, the relative truncation (pde) ';...
' error, and the relative residual are plotted ';...
' as functions of the iteration count. ';...
' ';...
' The intention is to demonstrate that multigrid ';...
' achieves truncation error accuracy quickly ';...
' and can reduce the discrete residual down to ';...
' very small tolerences. ';...
' ';...
' The PDE error (correct digits) and the average ';...
' residual reduction per iteration are also shown';...
' ';...
];
DEMO_INFO_FIG = figure('Position', [30 30 500 600],...
'Name', 'Demo3 Info',...
'NumberTitle', 'off', ...
'Color','blue');
[mm,nn] = size(page);
subplot(1,1,1)
hold off
cla
ht = 0.95;
for j = 1:mm
text(0.05, ht, page(j,:))
axis('off')
ht = ht - 0.04;
end
cb_uic_continue = 'close(DEMO_INFO_FIG), demo3_run';
demo3_uic_continue = uicontrol( 'Position', [0.1 0.10 0.35 0.07],...
'units', 'normalized',...
'style', 'pushbutton', ...
'string', 'Click here to continue',...
'backgroundcolor', 'cyan',...
'foregroundcolor', [0 0 0],...
'callback', cb_uic_continue);
cb_uic_cancel = 'close(DEMO_INFO_FIG)';
demo1_uic_cancel = uicontrol( 'Position', [0.55 0.10 0.35 0.07],...
'units', 'normalized',...
'style', 'pushbutton', ...
'string', 'Cancel',...
'backgroundcolor', 'cyan',...
'foregroundcolor', [0 0 0],...
'callback', cb_uic_cancel);
%
%===
%
cb_uic_Short = 'DEMO_VAR1 = 1;';
demo1_uic_cancel = uicontrol( 'Position', [0.10 0.20 0.2 0.07],...
'units', 'normalized',...
'style', 'pushbutton', ...
'string', '2 runs',...
'backgroundcolor', 'green',...
'foregroundcolor', [0 0 0],...
'callback', cb_uic_Short);
cb_uic_Medium = 'DEMO_VAR1 = 2;';
demo1_uic_cancel = uicontrol( 'Position', [0.40 0.20 0.2 0.07],...
'units', 'normalized',...
'style', 'pushbutton', ...
'string', '3 runs',...
'backgroundcolor', 'green',...
'foregroundcolor', [0 0 0],...
'callback', cb_uic_Medium);
cb_uic_Long = 'DEMO_VAR1 = 3;';
demo1_uic_cancel = uicontrol( 'Position', [0.70 0.20 0.2 0.07],...
'units', 'normalized',...
'style', 'pushbutton', ...
'string', '4 runs',...
'backgroundcolor', 'green',...
'foregroundcolor', [0 0 0],...
'callback', cb_uic_Long);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -