I'm trying to create a matrix M satisfying:
M(i,j) = f(i,j)
for some f. I can do elementwise initialization through say M = zeros(m,n)
then looping. For example (in Octave):
M = zeros(m,n)
for i = 1 : m
for j = 1 : n
m(i, j) = (i+j)/2;
endfor
endfor
But AFAIK loops are not the optimal way to go with MATLAB. Any hints?