1 |
siz |
|
sigma |
|
muadv |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (siz, sigma, muadv = 0)
{
x = 1:round(siz)
mu = c(mean(x), mean(x)) + muadv
fx = (matrix(exp((-0.5 * (x - mu[1])/sigma)^2))/(sqrt(2 *
pi) * sigma))
options(digits = 5)
fx = exp(-0.5 * ((x - mu[1])/sigma)^2)/sqrt((2 * pi) * sigma)
fy = exp(-0.5 * ((x - mu[2])/sigma)^2)/sqrt((2 * pi) * sigma)
fx[!is.finite(fx)] = 0
fy[!is.finite(fy)] = 0
kern = (fx %*% t(fy))
kern = kern/(sum(sum(kern, na.rm = T), na.rm = T))
kern[is.nan(kern)] = 0
kern
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.