MATLAB: Element in matrix multiplication to create a new matrix

matrix

A and O is 3×1 matrix
B and D is 1×3 matrix
f is a 3×3 matrix
What is wrong with the code below?
i=1:3
j=1:3
T(i,j)=A(i).*B(j).*O(i).*D(j).*f(i,j)

Best Answer

Your code doesn't run because you are using .* which is element wise multiplication instead of standar matrix multiplication. You can do:
for i=1:3
for j=1:3
T(i,j)=A(i).*B(j).*O(i).*D(j).*f(i,j)
end
end
or
T=A*B*O*D*f
depending on the result you are expecting.