![]() Line 6: We are using the exp function in Matlab to generate the y vector. In line 4 we have selected the figure, now we are cleaning the figure window if there is any figure in the window selected using the clf command. Line 5: Clf is used to clear the current figure window. Line 4: I have used the figure function to select the figure 1 window if it is already there and to create a figure window if it is not there. It is just only because of my convenience and you can choose your own range. There is no particular reason why I have chosen the numbers in the given range. You may have a question in your mind why I have chosen only the numbers between 1 and 5 with the interval 0.1? To know more about the colon operator then you can refer the following(You can also use the linspace to generate the same set of numbers): Colon operator is used to generate numbers in the given range with the required interval. Line 3: Here we are using the colon operator to generate a set of numbers in the given range. Or if you want to get a detailed explanation then the links are as follows: If you want to know what range & interval are, then you can see them here: Volume of a solid sphere and graph for different radius using Matlab. And also the comment on line 2 states that the range is 1 to 5 and the interval is 0.1. Line 1 & 2: These lines are Matlab comments and they state that the upcoming code is going to be the code for the exponential function. Here we discuss the Introduction to MATLAB Exponential and its different Examples as well as its input and output.I have saved this program as plotting.m on my local computer. We can also plot the functions which we have computed using the ‘plot’ expression, which allows us to visually interpret our function. We can use exp(x) syntax in MATLAB to calculate the exponential of any function which is passed as an argument. So, in this article, we learned how to use the exponential function in MATLAB. Let’s assume the values to be in the range. A plot is visually more powerful than normal data when we want to analyze the behavior of our function. Let us now learn how can we plot an exponential function. Let’s take value ‘-2’ for our understanding. We can also calculate the exponential of a logarithmic function. Let us now take exponential of another positive number. Let’s first compute the exponential of unity (1). ![]() Now we will understand the above syntax with the help of various examples Types of Exponential Function in MATLABīelow are the types of the exponential function in Matlab: 1. It can also be used for complex elements of the form z = x + iy. Y = exp ( X) will return the exponential function ‘e’ raised to the power ‘x’ for every element in the array X. Now we have brushed our understanding of exponential function, let’s understand its use in MATLAB. Example of MATLAB Exponential Functionīelow are the examples of MATLAB Exponential: This is a feature of exponential functions, indicating how fast they grow or decay. In the exponential decay of the function, the function decreases to half every time we add to x. G(x) =1/2 raised to the power x, which is an example of exponential decay, the function decreases rapidly as x increases.įor f(x) in the previous example, the function doubles every time we add to x. Following is a simple example of the exponential function:Īs depicted in the above graph, the exponential function increases rapidly. Let’s take another function:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |