
hold off
subplot(211)
hold on
for y = 0.1:0.1:1
    x = [0,0,y,y,1]
    Px_given_y = [0,1.0/y,1.0/y,0,0]
    plot(x,Px_given_y,'b')
end

xlabel('x_1')
ylabel('p(x_1 | 0<y<1)')
axis([-0.1,1.1,0,12])

subplot(212)
hold on
for y = 1.0:0.1:1.9
    x = [0,y-1,y-1,1,1]
    Px_given_y = [0,0,1.0/(2-y),1.0/(2-y),0]
    plot(x,Px_given_y,'r')
end

xlabel('x_1')
ylabel('p(x_1 | 1<y<2)')
axis([-0.1,1.1,0,12])



