nrm | R Documentation |
This function takes in a vector and outputs a recalibrated vector according to the min and max values set in the function argument. The min and the max values are set to min=0 and max=1 by default. Hence the name nrm(X)
nrm(x, min, max)
x |
denotes the vector that needs recalibration |
min |
denotes the minimum value of the vector that you want to recalibrate your input vector(X) to. Default set to min=0. |
max |
denotes the maximum value of the vector that you want to recalibrate your input vector(X) to. Default set to max=1. |
Chitran Ghosal
##testing the function1
vec_in <- c(1,1.5,3)
vec_out <- nrm(vec_in, min = 2, max = 100)
##testing the function2
t <- seq(-11,11, by=0.05)
y <- 35*sin(0.05*t)*cos(t+0.75)
par(mfrow=c(2,1))
plot(t,y,type = 'b' )
y <- nrm(y)
plot(t,y, col='red', typ='l')
########################################
## The function is currently defined as
nrm <- function(X, min=0, max=1){
Y <- ((max - min)/(max(X) - min(X)))*(X - min(X)) + min
return(Y)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.