
Exponential function in Matlab
Let me explain to you how to work with the exponential function in Matlab.
So, what is this exponential function we're talking about? It's simply a function defined as e to the power of x, where "e" is the base of natural logarithm, also known as Euler's number, and approximately equals e=2.7183. $$ f(x)=e^x $$ The independent variable is x, and the function increases rapidly, starting from 1 when x is equal to 0.
Matlab has a nifty little function that can help us obtain the exponential function. It's called exp(x), and you simply need to type it in the command window and pass a value of x as the input parameter.
exp(x)
Let me show you an example. Type in exp(1) and see what happens.
That's right, you get the number e, which is approximately equal to 2.7183. Why, you ask? Because "e" to the power of 1 is e1=2.7183.
>> exp(1)
ans = 2.7183
Now, try typing in exp(0).
You'll notice that the result is 1, since e to the power of 0 is always 1.
>> exp(0)
ans = 1
Lastly, try typing in exp(-1) and see what happens.
The result is a smaller number, because ex approaches zero as x→-∞.
>> exp(-1)
ans = 0.3679