# 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.

``````clc
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.

``````clc
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.

Contribute
DelftStack is a collective effort contributed by software geeks like you. If you like the article and would like to contribute to DelftStack by writing paid articles, you can check the write for us page.

## Related Article - MATLAB Matrix

• MATLAB Create Random Matrix