how to multiply a 1xn matrix with a 1xn matrix and get the answer in the form of a 1xn matrix

a have the following matrices:
a= [1 5 3 8]
and
b= [4 6 1 9]
how do i multiply each term in a by the equivalent term of the other matrix in b?
so the answer would be:
ab= [4 30 3 72]
I'm really stuck, I've been transposing them but it obviously just gives me one numerical answer..
help!

 Accepted Answer

ab = a .* b; % Note the dot asterisk, dot meaning element-wise

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!