function [MAPs, MMSEs] = prob7_2(Ys)

xs = [-5:0.005:20];
ys = [];
MAPs = [];
MMSEs = [];

for Y=Ys,
  ypost = prob7(Y,xs);
  ys = [ys; ypost/max(ypost)];
  
  [m ii] = max(ypost);
  MAPs = [MAPs xs(ii)];
  expectedposterior = expectedprob7(Y,xs);
  MMSEs = [MMSEs expectedposterior];
end;

clf;
hold on;
plot(xs,ys)

ypmaps = [];
ypmmses = [];

for ypi =1:length(MAPs),
  divisor = max( prob7(Ys(ypi),xs) );
  ypmaps = [ypmaps prob7(Ys(ypi),MAPs(ypi))/divisor];
  ypmmses = [ypmmses prob7(Ys(ypi),MMSEs(ypi))/divisor];
end

MMSEs
ypmmses

plot(MAPs, ypmaps, '*');
plot(MMSEs, ypmmses, 'x');
hold off;
