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

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