Function implementation in Matlab I want to implement this function $[n,m] = a^{n+m}u[n]$ using 41×41 array, where $u[n] =1$ since all the value will be positive, and $n,m$ from 0 to 40. But it gives a wrong value.

N=40
M=40
a=0.9
x =zeros(41,41)
for col = 1:41
  for row = 1:41
    for k=0:N
      for i=0:M
        x(row,col)=a.^(k+i)*1;
      end
    end
  end
end
I believe this will do:

x=a.^((0:40)+(0:40)’)