I have a matrix A arbitrary sizes m x n and I want to fill it using the equation, for example, for each element a_ij A , i = 1, ..., m and j = 1, ..., n, I would like
a_ij = i ^ 2 + j ^ 2.
In manually filled matlab, it will look like this one,
A = [1^2+1^2, 1^2+2^2, ..., 1^2+j^2, ..., 1^2+n^2; 2^2+1^2, 2^2+2^2, ..., 2^2+j^2, ..., 2^2+n^2; . . . i^2+1^2, i^2+2^2, ..., i^2+j^2, ..., i^2+n^2; . . . m^2+1^2, m^2+2^2, ..., m^2+j^2, ..., m^2+n^2]
and therefore the first few terms will be:
[2, 5, 10,17,... 5, 8, 13,20,... 10,13,18,25,... 17,20,25,32,... ]