imag - Imaginary part of complex number - MATLAB (original) (raw)

Main Content

Imaginary part of complex number

Syntax

Description

`Y` = imag([Z](#mw%5Ffd3bab83-96bf-4f2a-95a7-6e56b26b0ab2)) returns the imaginary part of each element in array Z.

example

Examples

collapse all

Find the imaginary part of the complex number Z.

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

Z = [0.5i 1+3i -2.2]; Y = imag(Z)

Input Arguments

collapse all

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

Extended Capabilities

expand all

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

The imag 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