function foo = normplot(data);
%plots a historam of the matrix and overlays the normal distribution
%returns the integral of the nomal distribution - Neil Edelman 0121860

RES = 128;

figure(1);
hist(data);
m = mean(data);
s = std(data);
p0 = min(data) * .9;
p1 = max(data) * 1.1;
step = (p1 - p0) / RES;
x = [p0:step:p1];
y = (s * sqrt(2 * pi)).^-1 * exp(- (x - m).^2 / (2 * s.^2));
axis tight;
hold on;
plot(x,  y);
title 'Normal Distribution';
xlabel 'Value';
ylabel 'Frequency';
hold off;
foo = sum(y) * step;
