sum of rand matrix equal to zero
12 views (last 30 days)
More Answers (2)
Bus141 on 5 May 2015
Edited: Bus141 on 5 May 2015
The command randn pulls from a normal distribution with distribution N(0,1), implying with a large enough sample the mean should be zero. The sum of all dimensions should also converge toward zero since the values above and below the mean will cancel each other out, as they have equal probability.
Michael Haderlein on 5 May 2015
What kind of random distribution do you want? Here I use normal distribution, for other distributions just replace randn by the respective function:
That's not exactly zero, but you'll not easily come close due to numerical precision.