0% found this document useful (0 votes)
254 views

Exponential - MATLAB Exp

The exp function in MATLAB calculates the exponential of each element of the input array X. For real values of X, exp returns real values between 0 and infinity. For complex values of X, exp returns complex values. Examples show how to calculate scalar exponential values, plot the real-valued exponential function, and plot the complex-valued exponential function on the complex plane.

Uploaded by

Nur Azizah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
254 views

Exponential - MATLAB Exp

The exp function in MATLAB calculates the exponential of each element of the input array X. For real values of X, exp returns real values between 0 and infinity. For complex values of X, exp returns complex values. Examples show how to calculate scalar exponential values, plot the real-valued exponential function, and plot the complex-valued exponential function on the complex plane.

Uploaded by

Nur Azizah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

4/9/2014

Exponential - MATLAB exp

exp
Exponential Syntax
Y=e x p ( X )
example

Description
Y=e x p ( X )returns the exponential for each element of array X . The function accepts both real and complex inputs. For real values of Xin the interval (-Inf, Inf), e x preturns real values in the interval (0,Inf). For complex values of X ,e x preturns complex values.
example

Examples
Calculate Scalar Exponential Values
Examine several common values of the exponential function. Calculate the exponential of 0. e x p ( 0 ) a n s= 1 The result is 1, w hich is the y-intercept of the e x pfunction. Calculate the exponential of 1. e x p ( 1 ) a n s= 2 . 7 1 8 3 The result is equal to Euler's number, e. Calculate the exponential of i. e x p ( 1 i * p i ) a n s= 1 . 0 0 0 0+0 . 0 0 0 0 i The result of -1 is due to Euler's famous formula

collapse all

Calculate the exponential of I n f . e x p ( I n f ) a n s=


http://www.mathworks.com/help/matlab/ref/exp.html 1/5

4/9/2014

Exponential - MATLAB exp

0 The result is 0 since e x preturns small values for negative inputs.

Plot Real-Valued Exponential Function


Define the domain. X=( 1 : 0 . 5 : 5 ) ' ; Calculate the exponential of the vector, X . Y=e x p ( X ) Y= 0 . 3 6 7 9 0 . 6 0 6 5 1 . 0 0 0 0 1 . 6 4 8 7 2 . 7 1 8 3 4 . 4 8 1 7 7 . 3 8 9 1 1 2 . 1 8 2 5 2 0 . 0 8 5 5 3 3 . 1 1 5 5 5 4 . 5 9 8 2 9 0 . 0 1 7 1 1 4 8 . 4 1 3 2

The result is a vector of exponential values. Plot the function values. p l o t ( X , Y , ' L i n e W i d t h ' , 1 . 5 ) g r i do n ; t i t l e ( ' R e a l V a l u e dE x p o n e n t i a lF u n c t i o n ' ) ; x l a b e l ( ' X ' ) ;y l a b e l ( ' Y ' ) ;

http://www.mathworks.com/help/matlab/ref/exp.html

2/5

4/9/2014

Exponential - MATLAB exp

The real-valued exponential function maps values in the domain of all real numbers to the range of

Plot Complex-Valued Exponential Function


Define a grid of values for the (X,Y) domain. [ X , Y ]=m e s h g r i d ( 0 : 0 . 5 : 1 0 , 0 : 0 . 5 : 1 0 ) ; Calculate the complex exponential on the grid. Z=e x p ( X + 1 i * Y ) ; Make a surface plot of the imaginary portion of the function. s u r f ( X , Y , i m a g ( Z ) ) g r i do n ;h o l do n ; x l a b e l ( ' X ' ) ;y l a b e l ( ' Y ' ) ;z l a b e l ( ' Z ' ) ; v i e w ( 4 4 , 4 2 )

http://www.mathworks.com/help/matlab/ref/exp.html

3/5

4/9/2014

Exponential - MATLAB exp

e x pis a continuous function on the complex plane. Plot the real portion of the function in the same figure. s u r f ( X , Y , r e a l ( Z ) ) v i e w ( 6 3 , 1 4 )

http://www.mathworks.com/help/matlab/ref/exp.html

4/5

4/9/2014

Exponential - MATLAB exp

In this plot, the real and complex portions of the function are 90 degrees out of phase. Analytically, this is because the real portion depends on c o s , w hereas the complex portion depends on s i n .

Input Arguments
X Input array scalar | vector | matrix | multidimensional array

expand all

More About
Algorithms
For complex inputs z = x + 1 i * y , the e x pfunction calculates the complex exponential e x p ( x ) . * ( c o s ( y )+ 1 i * s i n ( y ) ) .

collapse all

See Also
e x p i n t| e x p m| e x p m 1| l o g| l o g 1 0| m p o w e r| p o w e r

http://www.mathworks.com/help/matlab/ref/exp.html

5/5

You might also like