How to create an exponential curve in R?


To create an exponential curve, we can use exp function inside the plot function for the variable that we want to plot. For example, if we have a vector x then the exponential curve for the vector x can be created by using plot(x,exp(x)). We can use the exponential function for the variable that is appropriate based on the objective of the analysis, here we have shown only an example of how it works.

Example1

Live Demo

> x<-rpois(1000,5)
> plot(x,exp(x))

Output

Example2

Live Demo

> y<-runif(50,2,8)
> plot(y,exp(y))

Output

Updated on: 07-Nov-2020

4K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements