method (1-t)N0 + tN1
1 | gauss.interp(gauss1, gauss2, t = 0.5, method = c("wass2"))
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## test with 1-dimensional Gaussian distributions
objA = wrapgauss1d(mean=1, sd=0.5)
objZ = wrapgauss1d(mean=5, sd=2)
## let's interpolate for t=0.1 to t=0.9
vec.t = seq(from=0.1, to=0.9, by=0.1)
vec.obj = list()
for (i in 1:9){
vec.obj[[i]] = gauss.interp(objA, objZ, t=vec.t[i])
}
## let's visualize
draw.x = seq(from=-3, to=11, length.out=1234)
draw.A = gauss.eval(draw.x, objA)
draw.Z = gauss.eval(draw.x, objZ)
plot(draw.x, draw.A, type="l", xlim=c(-1,11), ylim=c(0,1), lwd=2,
xlab="x", ylab="y", main="Interpolated Gaussians between Two Black")
lines(draw.x, draw.Z, lwd=2)
for (i in 1:9){
draw.t = gauss.eval(draw.x, vec.obj[[i]])
lines(draw.x, draw.t, col=(i+1), lty=2, lwd=0.5)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.