exp

Syntax

Description

example

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.

Examples

expand all

Numeric Representation of e

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

exp(1)
ans =

    2.7183

Euler's Identity

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

Compute the value of e.

Y = exp(1i*pi)
Y =

  -1.0000 + 0.0000i

Real-Valued Exponential Function

Create a vector of real numbers in the interval [-1,5].

X = (-1:0.5:5)';

Calculate the exponential of X.

Y = exp(X)
Y =

    0.3679
    0.6065
    1.0000
    1.6487
    2.7183
    4.4817
    7.3891
   12.1825
   20.0855
   33.1155
   54.5982
   90.0171
  148.4132

Complex-Valued Exponential Function

Create two Cartesian grids for X and Y.

[X,Y] = meshgrid(0:0.5:1.5,0:0.5:5);

Calculate the complex exponential $e^{X+iY}$. Use 1i for improved speed and robustness with complex arithmetic.

Z = exp(X + 1i*Y)
Z =

   1.0000 + 0.0000i   1.6487 + 0.0000i   2.7183 + 0.0000i   4.4817 + 0.0000i
   0.8776 + 0.4794i   1.4469 + 0.7904i   2.3855 + 1.3032i   3.9331 + 2.1486i
   0.5403 + 0.8415i   0.8908 + 1.3874i   1.4687 + 2.2874i   2.4215 + 3.7712i
   0.0707 + 0.9975i   0.1166 + 1.6446i   0.1923 + 2.7115i   0.3170 + 4.4705i
  -0.4161 + 0.9093i  -0.6861 + 1.4992i  -1.1312 + 2.4717i  -1.8650 + 4.0752i
  -0.8011 + 0.5985i  -1.3209 + 0.9867i  -2.1777 + 1.6268i  -3.5905 + 2.6822i
  -0.9900 + 0.1411i  -1.6322 + 0.2327i  -2.6911 + 0.3836i  -4.4368 + 0.6325i
  -0.9365 - 0.3508i  -1.5440 - 0.5783i  -2.5456 - 0.9535i  -4.1969 - 1.5721i
  -0.6536 - 0.7568i  -1.0777 - 1.2478i  -1.7768 - 2.0572i  -2.9294 - 3.3918i
  -0.2108 - 0.9775i  -0.3475 - 1.6117i  -0.5730 - 2.6572i  -0.9447 - 4.3810i
   0.2837 - 0.9589i   0.4677 - 1.5810i   0.7711 - 2.6066i   1.2713 - 4.2976i

Input Arguments

expand all

X — Input arrayscalar | vector | matrix | multidimensional array

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

Data Types: single | double
Complex Number Support: Yes

Output Arguments

expand all

Y — Exponential valuesscalar | vector | matrix | multidimensional array

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

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.

See Also

| | | | | |

Was this topic helpful?