Taking outer product of two matrices
58 次查看(过去 30 天)
显示 更早的评论
I have a 3x3 displacement matrix (let us call it u). The displacement gradient tensor F is given by
F = I + ∇ ⊗ u
where,
I = identity matrix
∇ = gradient operator
Can someone help me code this in MATLAB?
11 个评论
Umar
2024-7-15
Hi @Stephen23,
I never said that my code uses element wise application. To help you understand, it is basically very simple to understand, it is attempting to calculate the outer product of two vectors which results in a matrix where the (i,j)th entry is given by the product of the ith element of u and the jth element of v. For more information regarding basic concepts of array and matrixes, please refer to https://www.mathworks.com/help/matlab/learn_matlab/matrices-and-arrays.html Again, thanks for your contribution and feedback.
采纳的回答
Stephen23
2024-7-15
编辑:Stephen23
2024-7-15
"However, the ⊗ operator between ∇ and u isn't the simple multiplication operator *."
The Wikipedia page you linked to states "The outer product 𝑢⊗𝑣 is equivalent to a matrix multiplication 𝑢𝑣T, provided that 𝑢 is represented as a 𝑚×1 column vector and 𝑣 as a 𝑛×1 column vector (which makes 𝑣T a row vector)." So for vectors you can certainly use matrix multiplication. For higher dimension arrays you could leverage e.g. RESHAPE and TIMES ... or read the next part of my answer.
"It's the outer produt operator and hence I am finding it difficult to code it in MATLAB"
Google found this in two seconds (note: >=R2022a only):
A = rand(3,3);
B = rand(3,3);
C = tensorprod(A,B)
4 个评论
Umar
2024-7-16
No problem Priyanshu, glad to help you out. Please let us know if you still have any further questions, all our staff people are very knowledgeable and happy to help out.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!