Applying a function using elements of a vector and storing the results as elements in a matrix
Show older comments
Hi,
my aim is to use the elements of a vector for a function and store the results as elemets in a matrix.
I have a vector of size 10 (f.e.)
v = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
My function is: u(i,j) = v(i)*v(j)
I would like to itereate through the elements of the vector and multiply them, once for the rows and once for columns of the matrix (so basicly, I would like to take the first element of the vector and multiply it with each element of the vector and store the results in the first row of the matrix, and then repeat this process for all elements of the vector.)
Usually, I program with Python and therefore, I would use for loops but I would like to find a faster solution as my original matrix is 1000x1000.
Thanks, for your help.
Greetings
Anna
Accepted Answer
More Answers (0)
Categories
Find more on Numerical Integration and Differentiation 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!