How to get a Scalar from a Matrix and Two Vectors

27 ビュー (過去 30 日間)
Tom
Tom 2019 年 1 月 19 日
コメント済み: Tangi PERON 2022 年 3 月 18 日
If I am given a 3x3 matrix A and two 3x1 vectors X,Y I basically need to multiply them out with each other to get a scalar. My first attempt was
X'*A*Y
It could be due to the way that I have MATLAB set up, but if I do something like r'*r for two radial vectors it creates another vector rather than a scalar product, so in the example above I will just end up with a tensor when I really want a scalar ie. the matrix A has to multiply the vector on the right and then the transpose of the other vector on the left has to multiply the result to end up with a scalar.

採用された回答

madhan ravi
madhan ravi 2019 年 1 月 20 日
編集済み: madhan ravi 2019 年 1 月 20 日
Why not the below two possible options?
X*(A*Y) % A - 3 X 3 matrix , X - 3 X 1 vector , Y - 3 X 1 vector
Y*(A*X)
  1 件のコメント
Tangi PERON
Tangi PERON 2022 年 3 月 18 日
will this make a scalar product as he wanted ?

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

その他の回答 (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