Home > 16-Surface-Reconstruction > Profile-Reconstruction > fig_16_14_test_scale.m

fig_16_14_test_scale

PURPOSE ^

% Fig. 16.14 page 754

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% Fig. 16.14 page 754 
 compare different sampling distances

 Wolfgang Förstner 2014-08-06
 last changes: Susanne Wenzel 09/16
 wfoerstn@uni-bonn.de, wenzel@igg.uni-bonn.de

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Fig. 16.14 page 754
0002 % compare different sampling distances
0003 %
0004 % Wolfgang Förstner 2014-08-06
0005 % last changes: Susanne Wenzel 09/16
0006 % wfoerstn@uni-bonn.de, wenzel@igg.uni-bonn.de
0007 
0008 addpath(genpath('../../General-Functions/'));
0009 addpath('Functions')
0010 
0011 close all
0012 
0013 %% plot settings
0014 ss = plot_init;
0015 
0016 disp('..... compare different sampling distances -----')
0017 
0018 %% set parameters
0019 
0020 % params for generating the data
0021 init_rand = 8;            % may be changed for other example
0022 factorN = 80;             % ratio between grid distances
0023 sample = [2,3,4,10,12];   % given positions in units of factorN
0024 N = factorN*max(sample+1);% grid (corresponds to grid distance 1)
0025 sample = sample*factorN;  % given positions in units 1
0026 dens = 1.0;               % percentage of observed points in (0,1]
0027 sigma_e = 0.5;            % process noise
0028 sigma_n = 4;              % observation noise
0029 factor_sigma = 1;         % factor for sigma_n
0030 Poutlier = 0.0;           % fraction of outliers
0031 Max_outlier = 25;         % max(outlier)
0032 type_outlier = 0;         % symmetric   |  = 1; % asymmetric, following Kraus
0033 
0034 % params for estimation
0035 type_robust  = [0,2,2,0]; %  [0 = L1, 1 = Kraus,g_factor,w_factor]
0036 print_type   = 0;
0037 plot_type    = 0;
0038 
0039 Niter = 0;
0040 
0041 %% initialize random number generation by fixed seed
0042 init_rand_seed(init_rand);
0043 
0044 %% generate profile
0045 [x,y,out_in] = ...
0046     generate_observed_AR2(N,sigma_e,sigma_n,Poutlier,...
0047     Max_outlier,type_outlier,dens);
0048  
0049 % subsample
0050 Nsample = length(sample);
0051 select = zeros(Nsample,1);
0052 xs = zeros(Nsample,1);
0053 ys = zeros(Nsample,1);
0054 for i=1:Nsample
0055     select(i) = sample(i);
0056     xs(i) = x(sample(i));
0057     ys(i) = y(sample(i));
0058 end
0059 
0060 %% reconstruct profile dense
0061 [xest,A,ver,weights,Cov] = ...
0062     estimate_profile_robust...
0063     (N,select,ys,sigma_e,sigma_n*factor_sigma,Niter,type_outlier,type_robust,...
0064     plot_type,print_type);
0065 
0066 %% reconstruct profile sparse
0067 N_s = N/factorN;
0068 select_s = select/factorN;
0069 [xest_s,A_s,ver_s,weights_s,Cov_s] = ...
0070     estimate_profile_robust...
0071     (N_s,select_s,ys,sigma_e*factorN^(3/2),sigma_n*factor_sigma,Niter,...
0072     type_outlier,type_robust,plot_type,print_type);
0073 
0074 
0075 %% plot
0076 figure('name','Fig. 16.14: Test spacing','color','w',...
0077     'Position',[0.2*ss(1),0.2*ss(2),0.5*ss(1),0.5*ss(2)]);
0078 hold on;
0079 %plot(1:N,x,'--r','LineWidth',2)
0080 plot(factorN-1:N,xest(factorN-1:N),'--k','LineWidth',2)
0081 plot((1:N_s)*factorN,xest_s,'-b','LineWidth',2)
0082 plot(select,ys,'.b','MarkerSize',15)
0083 
0084 title(['Fig. 16.14: $N = ',num2str(N),'$ , high grid space $= ',num2str(factorN),...
0085     '$, $s_e = ',num2str(sigma_e),'$, $s_n = ',num2str(sigma_e),'$'],'FontSize',16);
0086 xlabel('$x$');ylabel('$z$');
0087 
0088 %% compare residuals
0089 v1___v80___dx_div_sigma_n = ...
0090     [xest(sample)-ys,...
0091     xest_s(select_s)-ys,...
0092     (xest(sample)-xest_s(select_s))/sigma_n] %#ok<NOPTS>

Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005