% LMex040308_4th.m
% Example 4.3.8 Truck-launced antitank missile Pages 310-11 in
% Larsen & Marx (2006) Introduction to Mathematical Statistics, 4th edition
% Based on LMex040306_4th.m
% Written Fall 2010 by Eugene Gallagher for EEOS601 Revised: 1/8/11
% Eugene.Gallagher@umb.edu 
% http://alpha.es.umb.edu/faculty/edg/files/edgwebp.html
% The army is soliciting proposlas requiring that the automatic sighting
% mechanism be sufficiently reliable to guarantee that 95% of the missiles
% fall no more than 50 feet short or 50 feet beyond the target. What is the
% largest sigma compatible with that degree of precision. Assume that Y,
% the distance a missile travels is normally distributed with its mean (mu)
% equal to the the length of separation between the truck and the target.
Zvalue=norminv(0.975);
%Zvalue=50/sigma so, 
sigma=50/Zvalue;
fprintf('\nThe largest acceptable sigma is %4.2f feet.\n',sigma)

% Plot Figure 4.3.7
X=-75:75;
mu=0;
Y = normpdf(X,mu,sigma);
plot(X,Y,'--r');
axis([-75 75 0 0.02]);
title('Figure 4.3.7: Tank Missile Precision','FontSize',20);
ax1=gca;
xlabel('Distance between truck and target','FontSize',16),
ylabel('f_y(y)','FontSize',16);
ax1=gca;
set(ax1,'xtick',-50:50:50,'FontSize',14,...
    'XTickLabel',{'mu-50','mu','mu+50'},'FontSize',14)
set(ax1,'ytick',0:.01:0.02,'FontSize',14)
hold on;
xf=-50:50;yf=normpdf(xf,mu,sigma);
fill([-50 xf 50]',[0 yf 0]',[.8 .8 1])
figure(gcf);pause
hold off;