I am trying to create a matrix M satisfying:
M(i,j) = f(i,j)
for some f. I can do elementary initialization, say M = zeros(m,n) , then a loop. 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 best way to work with MATLAB. Any clues?
user210870
source share