dot product in 3d

조회 수: 4 (최근 30일)
Mert Demir
Mert Demir 2022년 2월 7일
댓글: Mert Demir 2022년 2월 23일
I am trying to convert 2d dot product below to 3d.
Nk=100
Ne=5
for i=1:Nk
for j=1:Ne
exp(i,j)=dot(Q(j,:),v_y(i,:))
where Q is 5*5 transition matrix and v_y is 100*5 matrix
Nk=100
Ne=5
Nz=3
for i=1:Nk
for j=1:Ne
for k=1:Nz
exp(i,j,k)??
end
end
end
where v_y is 100*5*3 matrix and Z will be a transition matrix 3*3
  댓글 수: 2
VBBV
VBBV 2022년 2월 10일
편집: VBBV 2022년 2월 10일
exp(i,j)
exp(i,j,k)
exp is a standard Matlab function. Using it as matrix is not recommended.
Mert Demir
Mert Demir 2022년 2월 23일
thank you

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

답변 (1개)

KSSV
KSSV 2022년 2월 7일
Nk=100
Ne=5
Nz=3
for k = 1:Nz
for i=1:Nk
for j=1:Ne
exp(i,j,k) = dot(Q(j,:,k),v_y(i,:,k)) ;
end
end
  댓글 수: 1
Mert Demir
Mert Demir 2022년 2월 7일
Thank you but Q is 5*5 matrix and there is also a function Z 3*3 which should be multiply with the v_y as a dot product. Something like this
for k = 1:Nz
for i=1:Nk
for j=1:Ne
exp1(i,j,k) = dot(Q(j,:),v_y(i,:,k)) ;
exp2(i,j,k) = dot(Z(k,:),exp1(i,j,:)) ;
end
end

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

카테고리

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