MATLAB Transpose

Ammar Ali Apr 24, 2021
  1. Calculate the Transpose of a Matrix Using the transpose() Function in MATLAB
  2. Calculate the Complex Conjugate Transpose of a Matrix Using the ctranspose() Function in MATLAB
MATLAB Transpose

In this tutorial, we will discuss how to take the transpose of a matrix using the transpose() and ctranspose() function in MATLAB.

Calculate the Transpose of a Matrix Using the transpose() Function in MATLAB

The transpose() function is used to take the transpose of a vector or a matrix in MATLAB. You can also use the .' operator instead of this function which performs the same as the transpose() function. For example, let’s take the transpose of a matrix using the transpose() function. See the code below.

mat = [1 2 3; 4 5 6]
T_mat = transpose(mat)

Output:

mat =

     1     2     3
     4     5     6


T_mat =

     1     4
     2     5
     3     6

As you can see in the output, the second matrix is the transpose to of the first matrix. You can also use the .' operator to take the transpose of a given matrix. For example, see the code below.

T_mat = mat.' 

This will also give you the same result as the transpose() function. You can also take the transpose of a complex matrix using this function. Check this link for more details about the transpose() function.

Calculate the Complex Conjugate Transpose of a Matrix Using the ctranspose() Function in MATLAB

The ctranspose() function is used to take the complex conjugate transpose of a vector or a matrix in MATLAB. You can also use the ' operator instead of this function which performs the same as the ctranspose() function. For example, let’s take the complex conjugate transpose of a complex matrix using the ctranspose() function. See the code below.

mat = [1+2i 2+3i]
T_mat = ctranspose(mat)

Output:

mat =

   1.0000 + 2.0000i   2.0000 + 3.0000i


T_mat =

   1.0000 - 2.0000i
   2.0000 - 3.0000i

As you can see in the output, the second matrix is the complex conjugate transpose of the first matrix. You can also use the ' operator to take the complex conjugate transpose of a given matrix. For example, see the code below.

T_mat = mat' 

This will also give you the same result as the ctranspose() function. Note that this function will perform the same as the transpose() function if the given matrix contains only real numbers. Check this link for more details about the ctranspose() function.

Author: Ammar Ali
Ammar Ali avatar Ammar Ali avatar

Hello! I am Ammar Ali, a programmer here to learn from experience, people, and docs, and create interesting and useful programming content. I mostly create content about Python, Matlab, and Microcontrollers like Arduino and PIC.

LinkedIn Facebook

Related Article - MATLAB Matrix