Here's a code snippet in MATLAB to create a 7x5 matrix satisfying the given conditions:
209 chars13 lines
Explanation:
A with dimensions 7x5, with all elements initialized to 0 using the zeros function.2r-3c where r and c are the current indices of the row and column respectively.disp function.Output:
main.m161 chars8 lines
This is the desired 7x5 matrix where each element follows the equation 2r-3c.
gistlibby LogSnag