How can I create a matrix with the values of the elements is a function of the indices?
Show older comments
I am trying to create a matrix from two vectors (i.e. A = [0:2] and B = [-2:2]) where the values for each cell of the matrix is a function of the indices. I cannot see the path to get it there, any simple examples I can follow?
Thanks
3 Comments
Stephen23
on 6 Jan 2018
The indices of the elements of vectors A and B are:
Ai = 1:numel(A)
Bi = 1:numel(B)
Is that what you want?
Image Analyst
on 6 Jan 2018
What is the function? Like the sum of the squares of A and B or something? Are you aware that your A and B don't have the same number of elements so you can't do a 1-to-1 correspondence between elements?
Benjamin Schuessler
on 6 Jan 2018
Edited: Benjamin Schuessler
on 6 Jan 2018
Accepted Answer
More Answers (0)
Categories
Find more on Operators and Elementary Operations 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!