heaviside | R Documentation |
Heaviside function (step function)
heaviside(x, x0 = 0)
x |
A vector of real numbers. |
x0 |
A real number. The x value at which the function step occurs. |
One of the two numbers 0 or 1.
x <- seq(-3,5,length=1000) x0 <- 1 y <- heaviside(x,x0) plot(x,y,type="l") # Step up and step down x1 <- seq(-3,5,length=1000) x10 <- 1 y1 <- heaviside(x1,x10) x2 <- seq(1,9,length=1000) x20 <- 5 y2 <- heaviside(x2,x20) y2 <- 1-y2 plot(x1,y1,type="l",xlim=c(-3,9),xlab="x",ylab="y") points(x2,y2,type="l")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.