real - Real part of complex number - MATLAB (original) (raw)

Main Content

Real part of complex number

Syntax

Description

`X` = real([Z](#mw%5F2f265058-af02-4bbc-b8d6-30f588060fe5)) returns the real part of each element in array Z.

example

Examples

collapse all

Find the real part of the complex number Z.

Find the real part of each element in vector Z. The real function acts on Z element-wise.

Z = [0.5i 1+3i -2.2]; X = real(Z)

Input Arguments

collapse all

Input array, specified as a scalar, vector, matrix, or multidimensional array.real operates element-wise when Z is nonscalar.

Extended Capabilities

expand all

Thereal function fully supports tall arrays. For more information, see Tall Arrays.

The real function fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray (Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).

Version History

Introduced before R2006a