MATLAB: How n(20*20 matrix) can obtain

basic mathmatrix

mean(s./n)=0.5
s= 1 2 3 4 5 ...20
20 19 18 17 16....1
1 2 3 4 5 ...20
20 19 18 17 16....1
1 2 3 4 5 ...20
20 19 18 17 16....1
...................
...................
20 19 18 17 16....1
s is a 20*20 matrix and it is fix; how n(20*20 matrix) can obtain such it follow above equation.

Best Answer

It's trivial. Just solve the equation for n! You'll find it's twice s. Here's proof:
% Construct s.
s2rows = [1:20;20:-1:1];
s = repmat(s2rows, [10,1])
% Here's n. It's just twice s!
n = s /0.5
% Proof that the mean = 0.5
theMean = mean2(s ./ n)