What does mean .* and ' ?

804 Ansichten (letzte 30 Tage)
Oliver Lestrange
Oliver Lestrange am 16 Aug. 2020
Beantwortet: Steven Lord am 7 Sep. 2020
Hi,
It seems that in MATLAB exists the notation .* that seems to be an operation and the notation ' that is used apparently with variables.
What is the meaning of these notations?

Akzeptierte Antwort

Steven Lord
Steven Lord am 7 Sep. 2020
The .* operator performs element-wise multiplication.
The ' character has at least three potential meanings that I can think of offhand.
The first potential meaning is that of the complex conjugate transpose.
A = [1 2+3i; 4 5+5i]
B = A'
Note that each row in B contains the same values as the corresponding column of A, except that complex numbers are replaced with their complex conjugates.
The second potential meaning is to create a char vector. This could be what Sara Boznik meant with "you use it usually when you want to have something displayed in Command Window."
x = 'apple'
The third is relevant inside a char vector. Two ' characters will create a single ' stored inside the char vector.
y = 'Simple, isn''t it?'

Weitere Antworten (2)

Sara Boznik
Sara Boznik am 16 Aug. 2020
.* means matrix product, if you don't write . will Matlab product the numbers on the same position.
' you use it usually when you want to have something displayed in Command Window.
Good luck.
  1 Kommentar
Stephen23
Stephen23 am 7 Sep. 2020
Bearbeitet: Stephen23 am 7 Sep. 2020
".* means matrix product, if you don't write . will Matlab product the numbers on the same position."
This is incorrect. In fact:
The difference is explained here:
"' you use it usually when you want to have something displayed in Command Window."
The complex conjugate transpose should be used when you need the complex conjugate transpose.

Melden Sie sich an, um zu kommentieren.


KSSV
KSSV am 16 Aug. 2020
Bearbeitet: KSSV am 16 Aug. 2020
.* this mean element by element multiplication. https://www.mathworks.com/help/matlab/ref/times.html
Example:
A = [1 2 ; 3 4] ;
B = [5 6 ; 7 8] ;
C = A.*B
' this stands for transpose of a matrix. https://www.mathworks.com/help/matlab/ref/transpose.html
EXample:
A = [1 2 ; 3 4] ;
B = A'
  1 Kommentar
Stephen23
Stephen23 am 16 Aug. 2020
"' this stands for transpose of a matrix. https://www.mathworks.com/help/matlab/ref/transpose.html "
This is incorrect. In fact
Sadly beginners often confuse the two, although they are not the same operation.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by