alpha = 0.05;
mu = 82.9;
sigma = 8.698;
cutoff1 = norminv(alpha, mu, sigma);
cutoff2 = norminv(1-alpha, mu, sigma);
x = [linspace(mu-4*sigma,cutoff1), ...
linspace(cutoff1,cutoff2), ...
linspace(cutoff2,mu+4*sigma)];
y = normpdf(x, mu, sigma);
figure
plot(x,y, 'black')
xlo = [x(x<=cutoff1) cutoff1];
ylo = [y(x<=cutoff1) 0];
patch(xlo, ylo, 'black')
xmid = [x(x>=cutoff1 & x<=cutoff2) cutoff2 cutoff1];
ymid = [y(x>=cutoff1 & x<=cutoff2) 0 0];
patch(xmid, ymid, 'red')
xhi = [cutoff2 x(x>=cutoff2)];
yhi = [0 y(x>=cutoff2)];
patch(xhi, yhi, 'black')
Best Answer