How to plot function with parameter in R -


i plot function several times, each time changing parameter (a constant) in function. how can this?

fun1 <- function(x, b) abs(x^2 - b^2) 

plot(fun1(b=0.1),-1, 1)

plot(fun1(b=0.2),-1, 1, add=true) 

same approach generalized in for-loop:

  (b in c(0.1,0.2))curve(abs(x^2 - b^2),add=true,col='red') 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -