How can I create a matrix with the values of the elements is a function of the indices?
Mostrar comentarios más antiguos
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 comentarios
Stephen23
el 6 de En. de 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
el 6 de En. de 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
el 6 de En. de 2018
Editada: Benjamin Schuessler
el 6 de En. de 2018
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Operators and Elementary Operations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!