I have the following code to calculate the number of real eigenvectors of a normally distributed matrix:
x=zeros(1,100); %make an 1x100 array of 0's
n = 1000;
for i=1:100
Nr=0;
a=normrnd(0,1,n); % make a nxn matrix N(0,1)
C=eig(a); %make c the eigen values of a
for k=1:n
if (isreal(C(k))==1) %loop through each value of c andcheck if it is real
Nr=Nr+1; %if it is real increment Nr
end
end
x(i)=Nr/sqrt(n);
end
Estimation_Of_C=mean (x)
Estimation_Of_Error=std (x)
According to http://math.mit.edu/~edelman/homepage/papers/howmany.pdf this should be equal to $\sqrt{\frac{2}{\pi}}$ however for whichever value of $n$ I use (bigger and smaller than 1000), I more often than not get Estimation_ofC> 0.8 so I appear to have a small systematic error.
Am I simply wanting the code to be too precise or do I have an actual error in my code?

The value $\sqrt \frac{2}{\pi}$ is in the limit when $n\rightarrow \infty$. If you use the asymptotic formula instead $$\frac{N_r}{\sqrt{n}} = \sqrt{\frac{2}{\pi}}+\frac{1}{2}\frac{1}{\sqrt{n}}+O(\frac{1}{n})$$ in your case $\sqrt{\frac{2}{\pi}}+\frac{1}{2}\frac{1}{\sqrt{1000}} \approx 0.8136959$