Main Content

exp

Description

Y = exp(X) returns the exponential ex for each element in array X. For complex elements z = x + iy, it returns the complex exponential

ez=ex(cosy+isiny).

Use expm to compute a matrix exponential.

example

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 eiπ+1=0.

Compute the value of eiπ.

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

Plot y=ex/2 for x values in the range [-2,10].

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, multidimensional array, table, or timetable.

Data Types: single | double | table | timetable
Complex Number Support: Yes

Output Arguments

collapse all

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

For real values of X in the interval (-Inf, Inf), Y is in the interval (0,Inf). For complex values of X, Y is complex. The data type of Y is the same as that of X.

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

expand all

See Also

| | | | | |