%CH05  Program for Chapter 5
%
% Illustrates quantile plot

clf
randn('state',100)

M = 200;

samples = randn(M,1);
ssort = sort(samples);

pvals = [1:M]/(M+1);
zvals =  sqrt(2)*erfinv(2*pvals-1);

plot(ssort,zvals,'rx')
hold on
xlim  = max(abs(zvals))+1;
plot([-xlim, xlim],[-xlim,xlim],'g--') % Reference of slope 1
title('N(0,1) quantile-quantile plot')
grid on
