vector multiplication and dot product

1 回表示 (過去 30 日間)
pravin behera
pravin behera 2015 年 4 月 11 日
回答済み: Roger Stafford 2015 年 4 月 12 日
i have 2 matrix and i want to do matrix multiplication, but the elements in matrix are vectors, so i want to take dot product of the elements, can u suggest me a way...
q=[a b;c d]*[e f]
where
a=[1 2 3]=b=c=d=e=f
the output will be [a.e+b.f ; c.e+d.f]
and expected output is [28;28]
please suggest a good way to tackle this problem
  2 件のコメント
Jan
Jan 2015 年 4 月 11 日
Please post the matrix q in valid Matlab syntax. It is not clearly defined yet. Do you mean this:
q = [1,2,3,1,2,3; ...
1,2,3,1,2,3]
pravin behera
pravin behera 2015 年 4 月 11 日
編集済み: per isakson 2015 年 4 月 11 日
q=[(1 2 3) (1 2 3); (1 2 3) (1 2 3)] * [(1 2 3) ; (1 2 3)]
=[ (1 2 3).((1 2 3) + (1 2 3).(1 2 3) ; (1 2 3).((1 2 3) + (1 2 3).(1 2 3)]
=[14+14 ;14+14]
=[28;28]
this is what i want to do

サインインしてコメントする。

採用された回答

Roger Stafford
Roger Stafford 2015 年 4 月 12 日
You cannot have the grouping q = [(1 2 3) (1 2 3); (1 2 3) .... for ordinary matrices, but you can do this:
[1 2 3 1 2 3;1 2 3 1 2 3]*[1 2 3 1 2 3].'
where ".'" denotes the transpose and the result will be [28;28].

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by