function xcrit = bayes_norm(m1, v1, p1, m2, v2, p2)

minx = min([m1 m2]);
minx = minx - 2*sqrt(max([v1 v2]));
maxx = max([m1 m2]);
maxx = maxx + 2*sqrt(max([v1 v2]));

x = [minx:0.5:maxx];

y1 = normcdf(x, m1, sqrt(v1));
y1 = (y1' - circshift(y1', 1))';
y1 = y1(2:length(x));

y2 = normcdf(x, m2, sqrt(v2));
y2 = (y2' - circshift(y2', 1))';
y2 = y2(2:length(x));

pw1 = (y1.*p1)./(y1.*p1 + y2.*p2);
pw2 = (y2.*p2)./(y1.*p1 + y2.*p2);

xcrit = [x(2:length(x))' pw1' pw2'];
