?? picardtolplot.m
字號:
function tol = PicardTolPlot(A, b)%% tol = PicardTolPlot(A, b);%% Given a psfMatrix A, and a right hand side image b,% this function plots the Picard condition, and allows% the user to graphically choose a tolerance for use in% the preconditioner.%% J. Nagy 12/30/01P = psfPrec(A, b, 0);e = 1./P.matdata;e = abs(reshape(e', prod(size(e)), 1));[e, idx] = sort(e);e = flipud(e);b = reshape( fftn(b)', prod(size(b)), 1 );b = abs( flipud( b(idx) ) ) / sqrt(prod(size(b)));figure h = gcf;semilogy(e)hold onsemilogy(b, 'r')legend('Eigenvalues', 'Fourier coefficients')drawnowSmoothPlot = input('Smooth the Fourier coefficeints? [n] ', 's');if isempty(SmoothPlot) SmoothPlot = 'n';endl = 1;while SmoothPlot == 'y' hold off figure(h) semilogy(e) hold on semilogy(medfilt1(b,l*10), 'r') legend('Eigenvalues', 'Fourier coefficients') drawnow if l > 5 break end SmoothPlot = input('Smooth the Fourier coefficeints? [n] ', 's'); if isempty(SmoothPlot) SmoothPlot = 'n'; end l = l + 1;enddisp(' ')disp('Use the mouse to locate where Fourier coefficients level off ')[k, y] = ginput(1);k = round(k);tol = e(k);plot(k, e(k), 'o')plot([k, k], [min(b), e(k)], 'k--')text(k, e(k), sprintf(' tol = %f', tol))NewPoint = input('Choose a different point? [n] ', 's');if isempty(NewPoint) NewPoint = 'n';endwhile NewPoint == 'y' figure(h) disp('Use the mouse to locate where the Fourier coefficients level off') [k, y] = ginput(1); k = round(k); tol = e(k); plot(k, e(k), 'o') plot([k,k], [min(b), e(k)], 'k--') text(k, e(k), sprintf(' tol = %f', tol)) NewPoint = input('Choose a different point? [n] ', 's'); if isempty(NewPoint) NewPoint = 'n'; endend
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -