%normal_dist.m: 
% program to generate random numbers that are
% normally distributed.
n=1000; %number of samples
%generate all n samples.
y=randn(1,n);
%plot the resulting data
subplot(1,2,1)
plot(y,'k');
box off
axis square 
xlabel('Sample index')
ylabel('Random number value')
%generate a histogram of the data to view the pdf
x = -2.9:0.1:2.9;
subplot(1,2,2)
hist(y)
box off
axis square 
xlabel('Bins')
ylabel('Bin count')
