0001
0002
0003
0004
0005
0006
0007
0008 addpath(genpath('../../General-Functions/'));
0009 addpath('Functions')
0010
0011 close all
0012
0013
0014 ss = plot_init;
0015
0016 disp('..... compare different sampling distances -----')
0017
0018
0019
0020
0021 init_rand = 8;
0022 factorN = 80;
0023 sample = [2,3,4,10,12];
0024 N = factorN*max(sample+1);
0025 sample = sample*factorN;
0026 dens = 1.0;
0027 sigma_e = 0.5;
0028 sigma_n = 4;
0029 factor_sigma = 1;
0030 Poutlier = 0.0;
0031 Max_outlier = 25;
0032 type_outlier = 0;
0033
0034
0035 type_robust = [0,2,2,0];
0036 print_type = 0;
0037 plot_type = 0;
0038
0039 Niter = 0;
0040
0041
0042 init_rand_seed(init_rand);
0043
0044
0045 [x,y,out_in] = ...
0046 generate_observed_AR2(N,sigma_e,sigma_n,Poutlier,...
0047 Max_outlier,type_outlier,dens);
0048
0049
0050 Nsample = length(sample);
0051 select = zeros(Nsample,1);
0052 xs = zeros(Nsample,1);
0053 ys = zeros(Nsample,1);
0054 for i=1:Nsample
0055 select(i) = sample(i);
0056 xs(i) = x(sample(i));
0057 ys(i) = y(sample(i));
0058 end
0059
0060
0061 [xest,A,ver,weights,Cov] = ...
0062 estimate_profile_robust...
0063 (N,select,ys,sigma_e,sigma_n*factor_sigma,Niter,type_outlier,type_robust,...
0064 plot_type,print_type);
0065
0066
0067 N_s = N/factorN;
0068 select_s = select/factorN;
0069 [xest_s,A_s,ver_s,weights_s,Cov_s] = ...
0070 estimate_profile_robust...
0071 (N_s,select_s,ys,sigma_e*factorN^(3/2),sigma_n*factor_sigma,Niter,...
0072 type_outlier,type_robust,plot_type,print_type);
0073
0074
0075
0076 figure('name','Fig. 16.14: Test spacing','color','w',...
0077 'Position',[0.2*ss(1),0.2*ss(2),0.5*ss(1),0.5*ss(2)]);
0078 hold on;
0079
0080 plot(factorN-1:N,xest(factorN-1:N),'--k','LineWidth',2)
0081 plot((1:N_s)*factorN,xest_s,'-b','LineWidth',2)
0082 plot(select,ys,'.b','MarkerSize',15)
0083
0084 title(['Fig. 16.14: $N = ',num2str(N),'$ , high grid space $= ',num2str(factorN),...
0085 '$, $s_e = ',num2str(sigma_e),'$, $s_n = ',num2str(sigma_e),'$'],'FontSize',16);
0086 xlabel('$x$');ylabel('$z$');
0087
0088
0089 v1___v80___dx_div_sigma_n = ...
0090 [xest(sample)-ys,...
0091 xest_s(select_s)-ys,...
0092 (xest(sample)-xest_s(select_s))/sigma_n]