필터 지우기
필터 지우기

dot product for complex vector

조회 수: 40 (최근 30일)
Charles Nguyen
Charles Nguyen 2019년 6월 16일
답변: John D'Errico 2019년 6월 16일
Hello,
In the Matlab example, you have the dot product of the following two vectors A and B and its answer is vector C.
A = [1+i 1-i -1+i -1-i];
B = [3-4i 6-2i 1+2i 4+3i];
Calculate the dot product of A and B.
C = dot(A,B)
C = 1.0000 - 5.0000i
However, when I calculate it, I have vector C = 7 - 17i
That is, I have C vector results as follows below
(1+i) * (3-4i) + (1-i) * (6-2i) + (-1+i) * (1+2i) + (-1-i) * (4+3i) =
(7-i) +( 4-8i) + (-3-i) + (-1-7i) =
7 - 17i.
Hence, could you please tell me how the Matlab got the results (or show me manually how Matlab got the dot product answer) as I have different results than Matlab calculated using dot product?
Thank you,
Charles

채택된 답변

John D'Errico
John D'Errico 2019년 6월 16일
help dot
dot Vector dot product.
C = dot(A,B) returns the scalar product of the vectors A and B.
A and B must be vectors of the same length. When A and B are both
column vectors, dot(A,B) is the same as A'*B.
dot(A,B), for N-D arrays A and B, returns the scalar product
along the first non-singleton dimension of A and B. A and B must
have the same size.
So what are A and B?
A = [1+i 1-i -1+i -1-i];
B = [3-4i 6-2i 1+2i 4+3i];
They are row vectors, complex row vectors. So MATLAB forms the result as:
dot(A,B)
ans =
1 - 5i
sum(conj(A).*B)
ans =
1 - 5i
That is, when A and B are both vectors, MATLAB treats them the same as if A and B were column vectors. It effectively thinks of them as both column vectors. Then it forms the result by conjugating A, takes an element-wise product, then sums those terms.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by