% Lecture 5A example: Normally distributed star brightness % % Numerical pointwise evaluation, % without using the special normal-distribution formula theta = linspace(0,10,1000); % Try all these different theta values pri = normpdf(theta, 5, 1); lik = normpdf(3,theta,2) .* normpdf(8,theta,2) .* normpdf(7,theta,2); unpost= pri .* lik; % Pointwise multiplication post = unpost / sum(unpost); % Normalization clf subplot(3,1,1) plot(theta, pri) grid on title('prior for brightness') subplot(3,1,2) plot(theta, lik) grid on title('likelihood (from data 3,8,7)') subplot(3,1,3) plot(theta, post); grid on title('posterior for brightness')