Problem 42519. Sum My Indices
Given inputs M and N (in that order), output an MxN matrix whose entries are equal to the sum of their indices.
Example input/output pairs:
=============
Input: 1,2
Output: [2,3]
=============
Input: 2,2
Output: [2 3; 3 4]
=============
Input: 3,2
Output: [2,3; 3 4; 4 5]
Solution Stats
Problem Comments
-
2 Comments
Carl Witthoft
on 25 Nov 2015
Marginally related: my "outer.m" on FileExchange.
goc3
on 3 Mar 2018
Additional test cases have been added.
Solution Comments
Show commentsProblem Recent Solvers160
Suggested Problems
-
All your base are belong to us
528 Solvers
-
Project Euler: Problem 7, Nth prime
1392 Solvers
-
Return elements unique to either input
757 Solvers
-
middleAsColumn: Return all but first and last element as a column vector
595 Solvers
-
Matrix multiplication across rows
304 Solvers
More from this Author23
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!