% LMFig060204_4th.m
% Larsen & Marx (2001, p. 367).
% Normal probability pdf
% Written by Eugene.Gallagher@umb.edu
% written for EEOS601
z05=norminv(0.95)
z=-3.05:.001:3.05;
fzz=normpdf(z)
plot(z,fzz,'linestyle','--','color','r','linewidth',3)
ylabel('f_z(z)','FontSize',20)
xlabel('z','FontSize',22)
axis([-3.05 3.05 0 0.405])
set(gca,'Ytick',[0 0.2 0.4],'FontSize',18)
set(gca,'Xtick',[0 1.64],'XtickLabels',{'0','z_{0.05}=1.64'},'FontSize',18)
ax=axis;
ax1=gca; % save the handle of the graph
title('Figure 6.2.4','FontSize',22)
hold on
fz05=normpdf(z05);
plot([z05 z05]',[0 fz05]','-k','linewidth',1) 
% Fill in the upper tail with fill
y2=z05:.001:ax(2);
fy2=normpdf(y2);
fymax=normpdf(ax(2));
fill([z05 y2 ax(2) ax(2)],[0 fy2 fymax 0],[.8 .8 1])
t=sprintf('Area=%4.2f\n',p);
text(z05+.1,.1,t,'Color','b','FontSize',20);
figure(gcf)
hold off