Use a nested for-loop for this. Outer loop counts up from i=1 to N and the inner loop from n=1 to N.
for n = 1:N
for k = 1:N
r_0 = sum(rho_kn * r_k0 * r_n0);
r_0 = sqrt(r_0);
I replaced "i" by "k" here, because you could get in trouble when using i for loop count in combination with complex numbers. So i isnt recommended to use as a variable in matlab code.