I am trying to run a simulation, but before I do I wanted to write a simple program to ensure I could get a correct answer.
I start off by generating 10,000 long vector using a Normally distributed pseudorandom number generator (randn) with a mean =0 and sigma =1.
nsamples=100000; f=0 f=f+(1)*randn(nsamples,1);
x = f;
m = mean(f)
s = std(f)
I calculate the mean and std using the standard MATLAB functions (mean and std) verifying mean and sigma.
I then plot the data using the standard normal equation
where x is the RV, s=std deviation, and m is the mean.
I then integrate the PDF from -1 to 1 using the following commend
p1 = -.5 * ((x - m)/s) .^ 2;
p2 = (s * sqrt(2*pi));
G = exp(p1) ./ p2;
fun = @(x) G;
This generates another vector. So I calculate the mean of the CDF vector (cdfmean=mean(cdf)) and instead of getting something around 68% I get 56%