https://github.com/cran/pracma
Revision 9fdea5df822b16ff97fe3dfe8316fa643dbb466b authored by HwB on 20 July 2012, 00:00:00 UTC, committed by Gabor Csardi on 20 July 2012, 00:00:00 UTC
1 parent 9683335
Raw File
Tip revision: 9fdea5df822b16ff97fe3dfe8316fa643dbb466b authored by HwB on 20 July 2012, 00:00:00 UTC
version 1.1.6
Tip revision: 9fdea5d
sigmoid.R
##
##  s i g m o i d . R  Sigmoid Function
##


sigmoid <- function(x, a = 1, b = 0) {
    if (length(x) == 0) return(c())
    stopifnot(is.numeric(x) || is.complex(x))
    stopifnot(is.numeric(a), is.numeric(b))
    a <- a[1]; b <- b[1]

    1 / (1 + exp(-a*(x-b)))
}
back to top