필터 지우기
필터 지우기

Multi dimensional vector operation

조회 수: 1 (최근 30일)
MarshallSc
MarshallSc 2021년 11월 14일
댓글: Matt J 2021년 11월 15일
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:
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:
Which essentially do this calculation:
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
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.
MarshallSc
MarshallSc 2021년 11월 15일
Yes, they are quadratic. My actual values are in complex conjugate format so it is not a problem if they're not real values.

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2021년 11월 14일
편집: Matt J 2021년 11월 14일
L_squared=([hx(:),hy(:),hz(:)]\[rx(:),ry(:),rz(:)]).';
  댓글 수: 2
MarshallSc
MarshallSc 2021년 11월 15일
Thanks Matt for your answer. Shouldn't we identify each components of the matrix first (convert them into vectors containing x,y,z for each point) and then perform the operation on them, maybe in a for loop. The syntax you wrote appear to render a 3*3 matrix, while the actual size at the end of the calculation should be a 3*3 array each has a 3*1 vector. I converted them into 3*3 cell first and then want to do the subsequent operation. Something like this:
for i=1:3
for j=1:3
R{i,j}=[rx(i,j);ry(i,j);rz(i,j)];
H{i,j}=[hx(i,j);hy(i,j);hz(i,j)];
end
end
For each component of H or R in 3D, I need to have the 3*3 matrix for each point. For example:
for i=1:10
for j=1:10
L{i,j}=sqrt(R{i,j}/H{i,j});
end
end
But this one gives me 3*3 matrix with 6 elements as zero. I know the division of a 3*1 by 3*1 would be a 3*1, but based on the equation I noted in my original script, the Ls are obtained by simultaneous equations and would not be zero. Sorry if it's a little bit confusing.
Matt J
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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by