MATLAB: How to multiply two different length vectors using for loops in Matlab

using for loop

ie. [1 2 3] and [1 2] The results should be a vector [3 6 9]. That is (1×1)+(1×2)=3, (1×2)+(2×2)=6,(1×3)+(2×3)=9. Appreciate the help

Best Answer

A = [1 2 3]
B = [1 2]
C = sum(B.' * A, 1)