MATLAB: How to create it

creating matrix

How can I create a 5×5 matrix with the following criterion: aij = 2cos(0.4(i-j)π)

Best Answer

A bit more efficiently, using meshgrid:
[i,j] = meshgrid(1:5);
a = 2*cos(0.4*(i-j)*pi);