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); Related SolutionsMATLAB: How to Create a 5×5 matrix whose rows are (1:5) You can do that with simple vector multiplication:A = ones(5, 1) * (1:5); MATLAB: Matlab matrix with specific elements assume that i is from 1 to 5 and j is from 1 to 6:% i: 1 to 5% j: 1 to 6 [i,j] = meshgrid(1:5,1:6);a=2*(j-4).*(i+1)-3+i.*j;disp(a) Related QuestionHow to create this matrix [1 2 3 4 5;2 2 3 4 5;3 3 3 4 5;4 4 4 4 5;5 5 5 5 5]Matlab Trigonometry and built in functionsFinding the row/column locations of 1s in a boolean matrixHow to generate a Matrix of specific rows and columns using loop
Best Answer