필터 지우기
필터 지우기

Understanding the difference between normal multiplication between two vectors and multiplication with dot operator.

조회 수: 1 (최근 30일)
Hello all, I am trying to understood the difference between normal multiplication and mutliplication with dot operator in caseof two vectors.
For example,
If we have two vector H of dimension 2 X 4 and B of dimension 4 X 1 then writing
Y = H*B % ---(1)
do not cause any error.
But if we write
Y = H.*B %--- (2)
then it gives the following error: Arrays have incompatible sizes for this operation.
Any help is highly appreciated.
  댓글 수: 4
Walter Roberson
Walter Roberson 2023년 10월 20일
MATLAB does not have any dot operator. MATLAB has a series of operators whos representation involves two characters, the first of which happens to be a dot.
So in A.*B that is not parsed as A followed by an operator '.' followed by an operator '*' followed by B: it is parsed as A followed by a single operator designated by '.*' followed by B.
This is similar to the way that A>=B is not parsed as A followed by a > operator then a = operator then B, but is instead A followed by a single operator designed by '>=' followed by B

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by