Main Content

exp

Exponential

Syntax

Description

example

Y= exp(X)returns the exponentialexfor each element in arrayX. For complex elementsz=x+iy, it returns the complex exponential

e z = e x ( cos y + i sin y ) .

Useexpmto compute a matrix exponential.

Examples

collapse all

Calculate the exponential of 1, which is Euler's number,e.

exp(1)
ans = 2.7183

Euler's identity is the equality e i π + 1 = 0 .

Compute the value of e i π .

Y = exp(1i*pi)
Y = -1.0000 + 0.0000i

Plot y = e x / 2 forxvalues in the range [ - 2 , 1 0 ] .

X = -2:0.5:10; Y = exp(X/2); plot(X,Y)

Figure contains an axes object. The axes object contains an object of type line.

Input Arguments

collapse all

Input array, specified as a scalar, vector, matrix, or multidimensional array.

Data Types:single|double
Complex Number Support:Yes

Output Arguments

collapse all

Exponential values, returned as a scalar, vector, matrix, or multidimensional array.

For real values ofXin the interval (-Inf,Inf),Yis in the interval (0,Inf). For complex values ofX,Y是复杂的。的数据类型Yis the same as that ofX.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Version History

Introduced before R2006a