# Taking outer product of two matrices

49 visualizaciones (últimos 30 días)
Priyanshu el 13 de Jul. de 2024
Comentada: Umar el 16 de Jul. de 2024
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
⊗ = outer product of two matrices,
Can someone help me code this in MATLAB?
##### 11 comentariosMostrar 9 comentarios más antiguosOcultar 9 comentarios más antiguos
Stephen23 el 15 de Jul. de 2024
Editada: Stephen23 el 15 de Jul. de 2024
"Hence, illustrated my example with element wise multiplication."
None of your code uses element-wise multiplication.
Umar el 15 de Jul. de 2024
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.

Iniciar sesión para comentar.

Stephen23 el 15 de Jul. de 2024
Editada: Stephen23 el 15 de Jul. de 2024
"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)
C =
C(:,:,1,1) = 0.0016 0.0022 0.0001 0.0014 0.0007 0.0031 0.0041 0.0036 0.0037 C(:,:,2,1) = 0.0300 0.0403 0.0015 0.0265 0.0136 0.0581 0.0759 0.0680 0.0701 C(:,:,3,1) = 0.1153 0.1550 0.0059 0.1018 0.0525 0.2235 0.2921 0.2617 0.2698 C(:,:,1,2) = 0.1815 0.2438 0.0093 0.1602 0.0826 0.3515 0.4596 0.4117 0.4244 C(:,:,2,2) = 0.0327 0.0440 0.0017 0.0289 0.0149 0.0634 0.0829 0.0743 0.0766 C(:,:,3,2) = 0.1576 0.2118 0.0081 0.1392 0.0717 0.3054 0.3992 0.3576 0.3687 C(:,:,1,3) = 0.1604 0.2154 0.0082 0.1416 0.0730 0.3107 0.4061 0.3638 0.3751 C(:,:,2,3) = 0.2397 0.3220 0.0123 0.2116 0.1091 0.4643 0.6070 0.5437 0.5606 C(:,:,3,3) = 0.1568 0.2107 0.0081 0.1385 0.0714 0.3038 0.3972 0.3558 0.3669
##### 4 comentariosMostrar 2 comentarios más antiguosOcultar 2 comentarios más antiguos
Priyanshu el 16 de Jul. de 2024
Thank you for helping me with the concept. I understand the logic and i think the code will be good for me.
Umar el 16 de Jul. de 2024
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.

Iniciar sesión para comentar.

### Categorías

Más información sobre MATLAB en Help Center y File Exchange.

R2023b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by