imag
Returns the imaginary component of a complex number.
Syntax
R = imag(z)
Inputs
- z
- Any valid scalar | vector | matrix.
Outputs
- R
- scalar | matrix
Examples
Simple scalar input:
imag(2)
R = 0
Imaginary inputs:
imag(4i)
imag(1+2i)
R = 4
R = 2
Matrix inputs:
imag([1,2,3])
imag([i,-2i;1+i,1-i])
R = [ 0 0 0 ]
R = [ 1 -2 ; 1 -1 ]