0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 close all
0011 clear all
0012
0013 addpath(genpath('../General_Functions/'));
0014 addpath('Functions')
0015
0016
0017
0018 ss = plot_init;
0019
0020
0021
0022
0023
0024 init_rand = 6;
0025 Nd = 20;
0026 N = 3*Nd;
0027 dens = 1.0;
0028 sigma_e = 0.15;
0029 sigma_n = 0.9;
0030 Poutlier = 0.0;
0031 Max_outlier = 25;
0032 factor = 1.0;
0033
0034 type_outlier = 0;
0035
0036
0037 type_robust = [0,...
0038 2,...
0039 2,...
0040 1];
0041
0042
0043
0044
0045 print_type = 0;
0046 plot_type = 0;
0047
0048 if type_outlier ==0
0049 Niter = 1;
0050 if type_robust(4) > 0
0051 Niter = 6;
0052 end
0053 factor_sigma = 1;
0054 else
0055 Niter = 3;
0056 if type_roubust(1) == 0
0057 factor_sigma= 8;
0058 else
0059 factor_sigma= 1;
0060 end
0061 end
0062
0063
0064
0065 init_rand_seed(init_rand);
0066
0067
0068 [x,y,out_in,select,xs,ys] = ...
0069 generate_step_corner(Nd,sigma_e,sigma_n,Poutlier,Max_outlier,type_outlier,dens,factor);
0070
0071
0072 type_robust(4) = 0;
0073 xest_nonrob = estimate_profile_robust...
0074 (N,select,ys,sigma_e/factor_sigma,sigma_n,Niter,type_outlier,...
0075 type_robust,print_type,plot_type);
0076
0077
0078 type_robust(4) = 1;
0079 [xest_robust,A,v,weights] = estimate_profile_robust...
0080 (N,select,ys,sigma_e/factor_sigma,sigma_n,Niter,type_outlier,...
0081 type_robust,print_type,plot_type);
0082
0083
0084 figure('name','Fig. 16.18: Robust estimation for tackling steps and break points',...
0085 'color','w', 'Position',[0.1*ss(1),0.2*ss(2),0.9*ss(1),0.4*ss(2)]);
0086
0087 subplot(2,1,1);hold on
0088 plot(1:N,x,'--r','LineWidth',2)
0089 plot(1:N,xest_nonrob,'-k','LineWidth',2)
0090 plot(1:N,ones(N,1),'-k')
0091 plot(select,ys,'.b','MarkerSize',15)
0092 plot(2:N-1,weights(end-(N-3):end)+1,'.k','Markersize',15)
0093 ylim([0,N/3+8]); xlim([0,N+1]); axis equal
0094 xlabel('$x$'); ylabel('$z$');
0095 title('Fig. 16.18a: Without robust estimation');
0096
0097
0098 subplot(2,1,2);hold on
0099 plot(1:N,x,'--r','LineWidth',2)
0100 plot(1:N,xest_robust,'-k','LineWidth',2)
0101 plot(1:N,ones(N,1),'-k')
0102 plot(select,ys,'.b','MarkerSize',15)
0103 plot(2:N-1,weights(end-(N-3):end)+1,'.k','Markersize',15)
0104 xlim([0,N+1]); ylim([0,N/3+8]); axis equal
0105 xlabel('$x$'); ylabel('$z$');
0106 title({'Fig. 15.18b: With robust estimation.'...
0107 ['Iterations $1$ to $3$ use the $L_{12}$-norm,'...
0108 ' iterations $4$ to $6$ use the exponential weight function']});
0109
0110
0111
0112
0113
0114