1

In R, is there a way to draw the graph of a function? For example

h(x) =  x^5 + x^8 + (cos(x))^3 + 0.6e^x

I have tried, but keep receiving syntax errors such as unexpected ^ in h(x)

user3000205
  • 15
  • 1
  • 2

1 Answers1

3
h <- function(x) x^5 + x^8 + cos(x)^3 + .6*exp(x)

plot(1:10, h(1:10))

plot(1:10, h(1:10), pch=19, cex=3, col=rainbow(10, alpha=.5, .5), type='o', lty=2, ylab='', xlab='', main='Plots for da winnnn!')

enter image description here

Hillary Sanders
  • 5,778
  • 10
  • 33
  • 50