TASK: Evaluate an expression for a probability.
COMMENT: The normal probability distribution assigns a likelihood to each number x. This likelihood depends on x, but also on the average value (Greek letter MU) and a measure of spread (Greek letter SIGMA). The formula for the likelihood of the value x is:
| \begin{align} p(x) &= \dfrac{1}{\sigma \sqrt{2\pi}} e^{- {\left( \frac{x-\mu}{\sigma \sqrt{2}} \right)}^2} \end{align} |
INSTRUCTIONS:
Use MATLAB's input() statement to request values for
"mu", "sigma", and "x".
mu = ?;
sigma = ?;
x = ?;
A brave person can try to write the entire formula for p(x) in a single
line, carefully using parentheses:
p = ?;
But a better plan sees the formula as a set of pieces that can be
built first, and then assembled:
frac = 1 / ?;
top = ?;
bot = ?;
power = ( top / bot ) ^ 2;
p = frac * exp ( - power );
fprintf ( ' p(%g) = %g\n', x, p );
SUBMIT: Your work should be stored in a script file called "hw0035.m". Your script file should begin with at least three comment lines:
% hw0035.m
% YOUR NAME
% This script (describe what it does)
% Add any comments here that you care to make.
If this problem is part of an assignment, then submit it to Canvas.