0001
0002
0003
0004
0005
0006
0007
0008 close all
0009
0010
0011 addpath(genpath('../../General-Functions'));
0012
0013
0014 ss = plot_init;
0015
0016
0017
0018
0019 MK = 1000;
0020 M = 50;
0021 k = 1;
0022 g = 2*k;
0023 w = 2*k;
0024
0025
0026 vK = -5:10/(MK-1):5;
0027 v = -5:10/(M-1):5;
0028
0029
0030 weights = zeros(MK,1);
0031 for m = 1:MK
0032
0033 if vK(m) < g-w
0034 weights(m) = 0;
0035
0036 elseif vK(m) > g
0037 weights(m) = 0.985;
0038
0039 else
0040 weights(m) = 0.985/(1+(vK(m)-g)^4);
0041
0042 end
0043 end
0044 w_kraus=weights;
0045
0046
0047 weights = max( min( 1,1./abs(v(1:M))/k+0.0001 ),...
0048 ( (sign(v(1:M))/k)+1 )/2 ...
0049 );
0050 w_L1 = weights;
0051
0052 x = vK;
0053 y = w_kraus';
0054 rangeX = max(x) - min(x);
0055 rangeY = max(y) - min(y);
0056 Q = [diff(x) / rangeX; diff(y) / rangeY];
0057 L = [0, cumsum(sqrt(sum(Q .* Q)))];
0058 L = (length(L) / L(end)) * L;
0059 a = 1;
0060 b = 10;
0061 c = 60;
0062 index = rem(round(L) + a, c) <= b;
0063
0064
0065 figure('name','Fig. 16.16 Weight functions for outliers','color','w',...
0066 'Position',[0.2*ss(1),0.2*ss(2),0.4*ss(1),0.4*ss(2)]);
0067 hold on
0068
0069
0070 plot(v,w_L1,'-b','LineWidth',6)
0071 plot(v,min(0.985,0.95./abs(v(1:M))/k+0.0001)-0.003,'.k','MarkerSize',20)
0072
0073 yDashed = y;
0074 yDashed(index) = NaN;
0075 plot(x, yDashed,'color','r','LineWidth',6);
0076
0077 xlim([-5,5])
0078 ylim([-0.003,1.05])
0079 title('Fig. 16.16: weight functions for a/symmetric outliers')
0080 xlabel('$y$');ylabel('$w$');
0081