Home > 16-Profilereconstruction > 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 display('..... 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 Poutlier = 0.0;           % fraction of outliers
0030 Max_outlier = 25;         % max(outlier)
0031 type_outlier = 0;         % symmetric   |  = 1; % asymmetric, following Kraus
0032 
0033 % params for estimation
0034 type_robust  = [0,2,2,0]; %  [0 = L1, 1 = Kraus,g_factor,w_factor]
0035 print_type   = 0;
0036 plot_type    = 0;
0037 
0038 Niter = 0;
0039 
0040 %% initialize random number generation by fixed seed
0041 init_rand_seed(init_rand);
0042 
0043 %% generate profile
0044 [x,y,out_in] = ...
0045     generate_observed_AR2(N,sigma_e,sigma_n,Poutlier,...
0046     Max_outlier,type_outlier,dens);
0047  
0048 % subsample
0049 Nsample = length(sample);
0050 select = zeros(Nsample,1);
0051 xs = zeros(Nsample,1);
0052 ys = zeros(Nsample,1);
0053 for i=1:Nsample
0054     select(i) = sample(i);
0055     xs(i) = x(sample(i));
0056     ys(i) = y(sample(i));
0057 end
0058 
0059 %% reconstruct profile dense
0060 [xest,A,ver,weights,Cov] = ...
0061     estimate_profile_robust...
0062     (N,select,ys,sigma_e,sigma_n*factor_sigma,Niter,type_outlier,type_robust,...
0063     plot_type,print_type);
0064 
0065 %% reconstruct profile sparse
0066 N_s = N/factorN;
0067 select_s = select/factorN;
0068 [xest_s,A_s,ver_s,weights_s,Cov_s] = ...
0069     estimate_profile_robust...
0070     (N_s,select_s,ys,sigma_e*factorN^(3/2),sigma_n*factor_sigma,Niter,...
0071     type_outlier,type_robust,plot_type,print_type);
0072 
0073 
0074 %% plot
0075 figure('name','Fig. 16.14: Test spacing','color','w',...
0076     'Position',[0.2*ss(1),0.2*ss(2),0.5*ss(1),0.5*ss(2)]);
0077 hold on;
0078 %plot(1:N,x,'--r','LineWidth',2)
0079 plot(factorN-1:N,xest(factorN-1:N),'--k','LineWidth',2)
0080 plot((1:N_s)*factorN,xest_s,'-b','LineWidth',2)
0081 plot(select,ys,'.b','MarkerSize',15)
0082 
0083 title(['Fig. 16.14: $N = ',num2str(N),'$ , high grid space $= ',num2str(factorN),...
0084     '$, $s_e = ',num2str(sigma_e),'$, $s_n = ',num2str(sigma_e),'$']);
0085 xlabel('$x$');ylabel('$z$');
0086 
0087 %% compare residuals
0088 v1___v80___dx_div_sigma_n = ...
0089     [xest(sample)-ys,...
0090     xest_s(select_s)-ys,...
0091     (xest(sample)-xest_s(select_s))/sigma_n] %#ok<NOPTS>

Generated on Mon 19-Sep-2016 01:11:04 by m2html © 2005