set.seed(12122)
rows <- 100
columns <- 5

signal <- outer(rnorm(rows), sin(seq(0, 2 * pi, l = columns)))
matplot(t(signal), type = "l", lty = 1)

plot of chunk unnamed-chunk-1


signal_to_noise <- 0.2
noise <- matrix(rnorm(rows * columns, sd = sd(as.vector(signal))/signal_to_noise), 
    ncol = columns)

x <- signal + noise
ev_x <- eigen(crossprod(x))
ev_signal <- eigen(crossprod(signal))

layout(matrix(1:4, 2, 2))
plot(ev_x$values, col = 1:columns)
matplot(ev_x$vectors, col = 1:columns, type = "l", lty = 1)


plot(ev_signal$values, col = 1:columns)
matplot(ev_signal$vectors, col = 1:columns, type = "l", lty = 1)

plot of chunk unnamed-chunk-1


## no sin-like signal in the eigenvectors for x while first eigenvector
## corresponds to sin-like signal for ev_signal