

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.
#Plotting exponential functions in matlab code#
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. Y4 = (3*exp(-2*t)-4.*exp(-3*t)-0.2).I have saved this program as plotting.m on my local computer.

Title('Another example of an exponential function plotting in MATLAB') Let us understand this concept by looking at the following example. We can display them graphically using the plot() function. MATLAB provides the function exp() in which we pass an exponential function as an argument to plot exponential functions. MATLAB allows its users to use a wide range of pre-built MATLAB functions and commands. Use exp() Function to Plot Exponential Functions in MATLAB Title ('Exponential Graph of our Equation') We will first plot an exponential function without using any function.Īfterward, we will look at different examples with exponential function plotting using MATLAB functions. Let us understand this concept with the following example. Plot Exponential Function Without Using Any Pre-built Function in MATLAB If we look at the definition of an exponential function, then any function has an e constant with the increased power of any input.Įxponential functions contain real parameters, and the value of our function is directly proportional to the expression’s rate. Note that the exponential functions are plotted to see an equation’s rising and falling trends or an expression.Īny exponential function to be written as g(x) = y(x) where y is a positive number and g denotes an exponential expression. We will use different example codes and related outputs to clear your concepts and give you a complete insight into methods to an exponential function of any equation under observation in MATLAB. Plot an Exponential Function of Any Equation in MATLAB This tutorial will look at different ways to plot an exponential function of any equation under observation in MATLAB.
