- #1
randonmind
- 2
- 0
Hello
I need to evaluate Gaussian integral
K=1/(sqrt(2pi) int(-infinity +infinity) x^2 exp(-x^2/2) dx
by using
K=E[X^2] ∼Kn=1/N sum(x^2)
where x follows a normal distribution.
So far I have written this:
N=1000;
for i=1:n
x1(i+1)=x(i)+1/N*random('normal',0,1).^2
end
x1
but I am getting error messages.
Can anyone share their wisdom?
Thanks
Andreas
I need to evaluate Gaussian integral
K=1/(sqrt(2pi) int(-infinity +infinity) x^2 exp(-x^2/2) dx
by using
K=E[X^2] ∼Kn=1/N sum(x^2)
where x follows a normal distribution.
So far I have written this:
N=1000;
for i=1:n
x1(i+1)=x(i)+1/N*random('normal',0,1).^2
end
x1
but I am getting error messages.
Can anyone share their wisdom?
Thanks
Andreas