# NOT RUN {
# a doppler signal
n <- 256
tindex <- seq(0, 1, length=n)
j <- 5
f <- 10 * sqrt(tindex*(1-tindex)) * sin((2*pi*(1+2^((9-4*j)/5))) / (tindex+2^((9-4*j)/5)))
fnoise <- f + 0.4 * rnorm(n)
#### Ensemble statistics
op <- par(mfrow=c(5,3), mar=c(2,2,2,1))
layout(matrix(c(1, 1, 1, 2:13), 5, 3, byrow = TRUE))
plot(f, main="a doppler signal", xlab="", ylab="", type='l', ylim=range(fnoise))
points(fnoise); abline(h=0, lty=3)
#### Ensemble Patch Transform
taus <- c(5, 10, 20)
out <- list()
for (i in 1:length(taus))
out[[i]] <- eptransf(signal=fnoise, tau=taus[i], process=c("average", "average"))
for (i in 1:length(taus)) {
plot(out[[i]]$Epstat, type="l", xlab="", ylab="",
main=paste0("ensemble average of patch mean, tau=", taus[i]))
abline(h=0, lty=3)
}
for (i in 1:length(taus))
plot(out[[i]]$Epsd, type='l', xlab="", ylab="",
main=paste0("ensemble average of standard deviation, tau=", taus[i]))
out2 <- list()
for (i in 1:length(taus))
out2[[i]] <- eptransf(signal=fnoise, tau=taus[i], process=c("envelope", "average"))
for (i in 1:length(taus)) {
plot(out2[[i]]$EpM, type="l", col="red", xlab="", ylab="",
ylim=range(c(out2[[i]]$EpU,out2[[i]]$EpL)),
main=paste0("ensemble average of mean envelope, tau=", taus[i]))
points(fnoise, cex=0.1)
abline(h=0, lty=3); lines(out2[[i]]$EpU); lines(out2[[i]]$EpL)
}
for (i in 1:length(taus))
plot(out2[[i]]$EpR, type='l', xlab="", ylab="",
main=paste0("ensemble average of envelope distance, tau=", taus[i]))
par(op)
# }
Run the code above in your browser using DataLab