n = 1000000;
observe = 1;

% Naive way
% 1
class = rand(n,1) > .3;
means = class * 3;
stdev = class + 1;
x = randn(n,1) .* stdev + means;
% 2
antecedent = observe - .1 < x & x < observe + .1;
% 3
prob_apple = mean(class(antecedent));

% Least naive way
density_apple  = .7 * normpdf(observe, 3, 2);
density_orange = .3 * normpdf(observe, 0, 1);
