Multi dimensional vector operation
1 次查看(过去 30 天)
显示 更早的评论
Can someone please help me with figuring out the code for the operation below:
I have two sets of matrices, for example:
r_x=rand(3,3);r_y=rand(3,3);r_z=rand(3,3);
h_x=rand(3,3);h_y=rand(3,3);h_z=rand(3,3);
That is shown as, for x for example:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/800034/image.jpeg)
What I want to do is to take each component of the matrices in the 3 dimensions and form a column vector such that, for example for component (1,1):
r_11=[r_x(1,1);r_y(1,1);r_z(1,1)]; h_11=[h_x(1,1);h_y(1,1);h_z(1,1)]
And solve three sets of simultaneous equations:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/800039/image.jpeg)
Which essentially do this calculation:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/800044/image.jpeg)
I want to solve for the L matrix (r and h are known). I'd appreciate it if someone can please help me. Thank you.
2 个评论
Matt J
2021-11-14
编辑:Matt J
2021-11-14
Does the superscript 2 in L^2 mean the elements are squared? Because the equations are linear in L^2, it is unlikely that the solutions for L^2 will all be non-negative, and therefore unlikely that their square roots will be real-valued, if that's what you were hoping for.
采纳的回答
Matt J
2021-11-14
编辑:Matt J
2021-11-14
L_squared=([hx(:),hy(:),hz(:)]\[rx(:),ry(:),rz(:)]).';
2 个评论
Matt J
2021-11-15
For each component of H or R in 3D, I need to have the 3*3 matrix for each point.
You can't derive a 3x3 matrix L from two 3x1 vectors. That gives you only 3 equations for 9 unknowns.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!