Home > 16-Surface-Reconstruction > Profilereconstruction > fig_16_9_demo_profile_reconstruction.m

fig_16_9_demo_profile_reconstruction

PURPOSE ^

% Fig. 16.9 page 740

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% Fig. 16.9 page 740
 demo profile smoothing 

 Wolfgang Förstner 2014-10-07
 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.9 page 740
0002 % demo profile smoothing
0003 %
0004 % Wolfgang Förstner 2014-10-07
0005 % last changes: Susanne Wenzel 09/16
0006 % wfoerstn@uni-bonn.de, wenzel@igg.uni-bonn.de
0007 
0008 addpath('Functions')
0009 
0010 close all
0011 
0012 %% plot settings
0013 ss = plot_init;
0014 
0015 %% set parameters
0016 
0017 % generation of points
0018 N = 45;                % number of points
0019 
0020 % estimation
0021 Niter = 0;
0022 type_robust = zeros(4,1);
0023 
0024 % output
0025 print_type = 0;
0026 plot_type  = 0;
0027 factor_sigma = 1.5;    % factor for displying std of estimated profile
0028 
0029 %% ---------------------- LETS GO -----------------------------------------
0030 
0031 display('----- demo reconstruct profile with flattening and smoothing -----')
0032 
0033 %% generate point
0034 xs = [15,20,25,30]';
0035 zs = [-1.8,-2,2,0]'*2.5;
0036 
0037 %% reconstruct profile flat
0038 sigma_e = 1.0;    % process noise
0039 sigma_n = 0.25;   % observation noise
0040 
0041 [zest_flat,tmp,tmp,tmp,Cov_flat] = estimate_profile_robust_flat...
0042     (N,xs,zs,sigma_e,sigma_n,Niter,0,type_robust,print_type);
0043 
0044 % min_sigma = min(sqrt(diag(Cov_flat)))
0045 % max_sigma = max(sqrt(diag(Cov_flat)))
0046 % max_ratio = max(sqrt(diag(Cov_flat))/min_sigma)
0047 % average_standard_deviation=sqrt(trace(Cov)/N)
0048 
0049 %% reconstruct profile smooth
0050 sigma_e = 1.0;     % process noise
0051 sigma_n = 0.25;    % observation noise
0052 
0053 [zest_smooth,tmp,tmp,tmp,Cov_smooth] = estimate_profile_robust...
0054     (N,xs,zs,sigma_e,sigma_n,Niter,0,type_robust,print_type,plot_type); %#ok<*ASGLU>
0055 
0056 % min_sigma=min(sqrt(diag(Cov_smooth)))
0057 % max_sigma=max(sqrt(diag(Cov_smooth)))
0058 % max_ratio=max(sqrt(diag(Cov_smooth))/min_sigma)
0059 
0060 %% plot
0061 figure('name','Fig. 16.9 top: Profile smoothing','color','w',...
0062     'Position',[0.2*ss(1),0.2*ss(2),0.5*ss(1),0.5*ss(2)]);
0063 
0064 % flat reconstruction
0065 subplot(2,2,1); hold on
0066 plot(1:N,zest_flat,'-k','LineWidth',2)
0067 plot(xs,zs,'.b','MarkerSize',20)
0068 axis equal
0069 title('flat reconstruction','FontSize',16)
0070 xlim([5,50]);ylim([-20,15])
0071 
0072 % show precision
0073 subplot(2,2,3); hold on
0074 plot(xs,zs,'.b','MarkerSize',15)
0075 plot(1:N,zest_flat,'-k','LineWidth',2)
0076 plot(1:N,zest_flat+3*factor_sigma*sqrt(diag(Cov_flat)),'-r','LineWidth',1)
0077 plot(1:N,zest_flat-3*factor_sigma*sqrt(diag(Cov_flat)),'-r','LineWidth',1)
0078 title(['blow up factor for $\sigma_z = ',num2str(factor_sigma),'$'],'FontSize',16)
0079 axis equal; xlim([5,50]); ylim([-20,15]);
0080 
0081 % smooth reconstruction
0082 subplot(2,2,2);hold on;
0083 plot(1:N,zest_smooth,'-k','LineWidth',2)
0084 plot(xs,zs,'.b','MarkerSize',20)
0085 title('smooth reconstruction','FontSize',16)
0086 axis equal;xlim([5,50]);ylim([-20,15]);
0087 
0088 % show precision
0089 subplot(2,2,4);hold on;
0090 plot(xs,zs,'.b','MarkerSize',20)
0091 plot(1:N,zest_smooth,'-k','LineWidth',2)
0092 plot(1:N,zest_smooth+3*factor_sigma*sqrt(diag(Cov_smooth)),'-r','LineWidth',1)
0093 plot(1:N,zest_smooth-3*factor_sigma*sqrt(diag(Cov_smooth)),'-r','LineWidth',1)
0094 title(['blow up factor for $\sigma_z = ',num2str(factor_sigma),'$'],'FontSize',16)
0095 axis equal; xlim([5,50]);ylim([-20,15]);
0096 
0097 
0098

Generated on Mon 08-Jan-2018 17:21:49 by m2html © 2005