# dot product in 3d

6 views (last 30 days)
Mert Demir on 7 Feb 2022
Commented: Mert Demir on 23 Feb 2022
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 CommentsShow 1 older commentHide 1 older comment
Mert Demir on 23 Feb 2022
thank you

KSSV on 7 Feb 2022
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 CommentShow NoneHide None
Mert Demir on 7 Feb 2022
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

### Categories

Find more on Math Operations in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by