0001
0002
0003
0004
0005 load mmsamp;
0006
0007 figure('Name','fig13_1a');
0008 plot(x,y,'o');
0009 hold on;
0010
0011 fit = locfit(x,y,'deg',1,'kern','minmax','alpha',4000,'ev','grid','mg',200,'ll',0,'ur',1);
0012 xev = fit.fit_points.evaluation_points';
0013 yev = predict(fit,'fitp');
0014 plot(xev,yev);
0015
0016 fit = locfit(x,y,'deg',1,'h',0.05,'ev','grid','mg',100,'ll',0,'ur',1);
0017 xev = fit.fit_points.evaluation_points';
0018 yev = predict(fit,'fitp');
0019 plot(xev,yev,'red');
0020
0021 xx = 0:0.01:1;
0022 yy = 2-5*xx+5*exp(-(20*xx-10).*(20*xx-10));
0023 plot(xx,yy,'green');
0024
0025 legend('Data','Minimax','Constant h','True Mean');
0026
0027 hold off;