autoparam3beta
Analogous to autoparam3 but looking for the best regularization parameter beta if alpha = 0. See autoparam3.html for documentation.
Warning: This function clears variables, creates a directory and creates files.
Contents
Code
disp(' ') disp('----- Automatic choice of regularization parameter beta (for alpha = 0) -----') disp(' ')
close all; if ~exist('inseti','var') inseti = ''; end clearvars -except inseti; ticAutoParam = tic;
In-place settings:
% ---------------------------------------------------------------------- % Set initial regularization parameter beta: switch inseti case 'example3Dalg' beta0 = 1000; case 'fresnelPda' beta0 = 1E6; case 'shipBore' beta0 = 1000; case 'shipBorePdaNlast' beta0 = 1E-4; case 'fresnelShrink' beta0 = 1E3; case 'fresnelSynthShrink' beta0 = 0.01; case 'shipFactMeth' beta0 = 1; case 'defaultFactMeth' beta0 = 1; otherwise beta0 = 1E5; end % ---------------------------------------------------------------------- % Further in-place settings (changes are not recommended): % N = 30; % maximal number of steps in bisection method q = 500/1E-5; % quotient of alpha/beta (default: seti.alpha = 500; seti.beta = 1E-5;) dummy = 0; % 0: no dummy function (use IPscatt); 1: dummy function to test this routine (result \approx 500)
Initialization
inAuto01init; beta(1) = beta0; if dummy == 1 dummybeta = 1; % use dummy function for beta (default is alpha) end
Process
for i = 1:N % Evaluate the current beta alpha(i) = 0; % compute alpha (set it to zero) inAuto02eval; % Reconstruction with alpha and beta; check, whether discrepancy principle border reached; output result inAuto03decBeta; % decision (try beta and decide which beta is next tried) if breakfor % breakfor is set in inAuto03decBeta; break; end end
Output
if startbis == 0 disp('Attention: startbis is still 0, i.e. the choice was stopped although bisection method was not started yet.') disp('Suggestions:'); disp(' - Increase the number of iterations N to search a parameter.') disp(' - Increase seti.tau to reach the discrepancy principle.') disp(' - Increase the numer of iterations of the inversion to get a better result.') end if startbis == 1 disp('Choose last a as alpha, because it fulfills the discrepancy principle.') disp('Result of automatic parameter choice:') % fprintf('alpha = %g, beta = %g\n',alpha(i),beta(i)); % fprintf('results in dis = %g\n',disAlphaBeta(i)'); fprintf('beta = %g, alpha = 0\n',a); % is adapted for autoparam3beta fprintf('results in dis = %g\n',da); end tocAutoParam = toc(ticAutoParam); fprintf('Elapsed time of automatic parameter choice is %05.1f min.\n',tocAutoParam/60); % -- Plot results -- regplot = beta(1:stopind); % regplot is alpha(...) or beta(...) inAuto04plot; % plot
usevaralphabeta = 0; % take it out of service for further computations