0001
0002
0003
0004
0005
0006
0007
0008 close all
0009
0010 clearvars
0011
0012 addpath(genpath('../../General-Functions/'));
0013 addpath('Functions')
0014
0015
0016
0017 ss = plot_init;
0018
0019 disp('----- eliminate asymmetric outliers -----')
0020
0021
0022
0023
0024 init_rand = 8;
0025 N = 200;
0026 dens = 0.8;
0027 sigma_e = 0.5;
0028 sigma_n = 0.5;
0029 Poutlier = 0.4;
0030 Max_outlier = 25;
0031 type_outlier = 1;
0032
0033
0034 type_robust = [1,2,2,2];
0035
0036
0037
0038
0039
0040 print_type = 0;
0041 plot_type = 0;
0042
0043 Niter = 6;
0044 if type_outlier ==0
0045 factor_sigma = 1;
0046 else
0047 factor_sigma = 8;
0048 end
0049
0050
0051
0052 init_rand_seed(init_rand);
0053
0054
0055 [x,y,out_in,select,xs,ys] = ...
0056 generate_observed_AR2(N,sigma_e,sigma_n,Poutlier,Max_outlier,type_outlier,dens);
0057
0058
0059
0060 type_robust(1) = 0;
0061
0062
0063 xest = estimate_profile_robust...
0064 (N,select,ys,sigma_e/factor_sigma,sigma_n,Niter,type_outlier,...
0065 type_robust,print_type,plot_type);
0066
0067
0068
0069 type_robust(1) = 1;
0070 factor_sigma= 1;
0071
0072 xest_kraus = estimate_profile_robust...
0073 (N,select,ys,sigma_e/factor_sigma,sigma_n,Niter,type_outlier,...
0074 type_robust,print_type,plot_type);
0075
0076
0077
0078 figure('name','Fig. 16.17: Reconstruction of a profile with one-sided outliers',...
0079 'color','w', 'Position',[0.2*ss(1),0.1*ss(2),0.4*ss(1),0.8*ss(2)]);
0080
0081 subplot(2,1,1);hold on
0082 plot(1:N,x,'--r','LineWidth',3)
0083 plot(1:N,xest,'-k','LineWidth',2)
0084 plot(select,ys,'.b','MarkerSize',20)
0085 xlabel('$x$');ylabel('$z$');
0086 title('Fig. 16.17a: Reconstruction with one-sided $L_{12}$-weight function');
0087
0088 subplot(2,1,2);hold on
0089 plot(select,ys,'.b','MarkerSize',20)
0090 plot(1:N,x,'--r','LineWidth',3)
0091 plot(1:N,xest_kraus,'-k','LineWidth',2)
0092 xlabel('$x$');ylabel('$z$');
0093 title(['Fig. 16.17b: Reconstruction with the weight function of Kraus and Pfeifer,' ...
0094 ' $g = ', num2str(type_robust(2)),', w = ',num2str(type_robust(3)),'$']);
0095
0096