The R Project SVN R

Rev

Rev 27541 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27541 Rev 27733
Line 53... Line 53...
53
\examples{
53
\examples{
54
x <- c(0,0,0,100,0,0,0)
54
x <- c(0,0,0,100,0,0,0)
55
y <- c(0,0,1, 2 ,1,0,0)/4
55
y <- c(0,0,1, 2 ,1,0,0)/4
56
zapsmall(convolve(x,y))         #  *NOT* what you first thought.
56
zapsmall(convolve(x,y))         #  *NOT* what you first thought.
57
zapsmall(convolve(x, y[3:5], type="f")) # rather
57
zapsmall(convolve(x, y[3:5], type="f")) # rather
58
x <- stats::rnorm(50)
58
x <- rnorm(50)
59
y <- stats::rnorm(50)
59
y <- rnorm(50)
60
# Circular convolution *has* this symmetry:
60
# Circular convolution *has* this symmetry:
61
all.equal(convolve(x,y, conj = FALSE),
61
all.equal(convolve(x,y, conj = FALSE), rev(convolve(rev(y),x)))
62
          rev(convolve(rev(y),x)))
-
 
63
 
62
 
64
n <- length(x <- -20:24)
63
n <- length(x <- -20:24)
65
y <- (x-10)^2/1000 + rnorm(x)/8
64
y <- (x-10)^2/1000 + rnorm(x)/8
66
 
65
 
67
Han <- function(y) # Hanning
66
Han <- function(y) # Hanning