Transpose matrix in Matlab

To transpose a matrix in MATLAB, I use the transpose() function:

transpose(A)

where A is the matrix to transpose.

Alternatively, I can simply add a single quote (') after the matrix variable:

A'

or use a period followed by a single quote (.'):

A.'

Both methods produce the transposed matrix.

Note: When working with real numbers, you can transpose the matrix using just a single quote, A', and get the same result. However, with complex numbers, A' returns the conjugate transpose, equivalent to conj(A').

    Practical Example

    To create a matrix, I enter:

    A = [ 1 2 3 ; 4 5 6 ; 7 8 9 ]

    This produces a square matrix:

    $$ A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix} $$

    To transpose the matrix, I simply enter:

    A.'

    or

    A = [ 1 2 3 ; 4 5 6 ; 7 8 9 ].'

    The result is the transposed matrix of A:

    $$ A.' = \begin{pmatrix} 1 & 4 & 7 \\ 2 & 5 & 8 \\ 3 & 6 & 9 \end{pmatrix} $$

    And so on.

     
     

    Please feel free to point out any errors or typos, or share suggestions to improve these notes. English isn't my first language, so if you notice any mistakes, let me know, and I'll be sure to fix them.

    FacebookTwitterLinkedinLinkedin
    knowledge base

    Matrix in Matlab