8

Trying to understand MATLAB syntax: I see that

(0:3)

is a row vector, that the ' (forward-quote) operator is transpose, so

(0:3)'

is a column vector. I have also seen .' in some files, and these also produce column vectors, so

(0:3).'

produces the same result as (0:3).

What is the difference between ' and .'? I haven't found anything in the MATLAB docs to help me understand this.

(note that this question is about syntax, primarily, not about the difference between transpose and ctranspose, because if you don't know that ' is one and .' is the other, than an answer to the question of transpose versus ctranspose is of no help answering the question of . versus '.. In many MATLAB examples and tutorials, ' is glibly and inaccurately presented as transpose, and that fact leads to the question when a user first encounters .'.)

Reb.Cabin
  • 5,426
  • 3
  • 35
  • 64

1 Answers1

11

There is no difference for real numbers. For complex numbers .' will produce transpose, while ' will produce the complex conjugate.

>> [i -i].'

ans =

   0.0000 + 1.0000i
   0.0000 - 1.0000i

>> [i -i]'

ans =

   0.0000 - 1.0000i
   0.0000 + 1.0000i

By the way, each Matlab operator has a name, which can be used to read the documentation.

  • .' - transpose
  • ' - ctranspose

Though it is hard to find them in the documentation sometimes. Most of them can be found in here, but you will have to guess which operator is which.

Andrey Rubshtein
  • 20,795
  • 11
  • 69
  • 104