Generate matrix that is a product of its indices
2 views (last 30 days)
Show older comments
I need to generate an n-by-n matrix, M. The n-by-n matrix elements are given by the product of its indices, M_ij=i*j-(i+j). I'm not very experienced with Matlab. How would I go about this?
0 Comments
Accepted Answer
Bruno Luong
on 23 Aug 2019
Edited: Bruno Luong
on 23 Aug 2019
n = 5;
i = (1:n)';
j = 1:n;
M = i.*j - (i+j)
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!