convolve(stats)
convolve()所属R语言包:stats
Convolution of Sequences via FFT
通过FFT的序列卷积
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Use the Fast Fourier Transform to compute the several kinds of convolutions of two sequences.
使用快速傅立叶变换计算两个序列卷积的几种。
用法----------Usage----------
convolve(x, y, conj = TRUE, type = c("circular", "open", "filter"))
参数----------Arguments----------
参数:x,y
numeric sequences of the same length to be convolved.
相同长度的数字序列进行卷积。
参数:conj
logical; if TRUE, take the complex conjugate before back-transforming (default, and used for usual convolution).
逻辑;如果TRUE,采取前回转型(默认情况下,使用通常的卷积)的复共轭。
参数:type
character; one of "circular", "open", "filter" (beginning of word is ok). For circular, the two sequences are treated as circular, i.e., periodic. For open and filter, the sequences are padded with 0s (from left and right) first; "filter" returns the middle sub-vector of "open", namely, the result of running a weighted mean of x with weights y.
字符;之一"circular","open","filter"(单词的开头是OK)。 circular,两个序列为圆形,即定期处理。 open和filter,0S(左,右)第一填充序列;"filter"返回"open"中间亚矢,即的运行x重量y的加权平均的结果。
Details
详情----------Details----------
The Fast Fourier Transform, fft, is used for efficiency.
快速傅立叶变换,fft,用于效率。
The input sequences x and y must have the same length if circular is true.
输入序列x和y必须有相同的长度circular如果是真实的。
Note that the usual definition of convolution of two sequences x and y is given by convolve(x, rev(y), type = "o").
请注意,通常定义两个序列的卷积x和yconvolve(x, rev(y), type = "o")。
值----------Value----------
If r <- convolve(x,y, type = "open") and n <- length(x), m <- length(y), then
如果r <- convolve(x,y, type = "open")和n <- length(x),m <- length(y),然后
where the sum is over all valid indices i, for k = 1, …, n+m-1.
总和超过所有有效的指标是i,k = 1, …, n+m-1。
If type == "circular", n = m is required, and the above is true for i , k = 1,…,n when x[j] := x[n+j] for j < 1.
如果type == "circular",n = m是必需的,上面是如此i , k = 1,…,n当x[j] := x[n+j]j < 1。
参考文献----------References----------
Time Series: Data Analysis and Theory, Second Edition. San Francisco: Holden-Day.
参见----------See Also----------
fft, nextn, and particularly filter (from the stats package) which may be more appropriate.
fft,nextn,尤其是filter(stats包)可能更合适。
举例----------Examples----------
require(graphics)
x <- c(0,0,0,100,0,0,0)
y <- c(0,0,1, 2 ,1,0,0)/4
zapsmall(convolve(x,y)) # *NOT* what you first thought.[*不*你首先想到的。]
zapsmall(convolve(x, y[3:5], type="f")) # rather[比较]
x <- rnorm(50)
y <- rnorm(50)
# Circular convolution *has* this symmetry:[循环卷积*有*这个对称性:]
all.equal(convolve(x,y, conj = FALSE), rev(convolve(rev(y),x)))
n <- length(x <- -20:24)
y <- (x-10)^2/1000 + rnorm(x)/8
Han <- function(y) # Hanning[寒凝]
convolve(y, c(1,2,1)/4, type = "filter")
plot(x,y, main="Using convolve(.) for Hanning filters")
lines(x[-c(1 , n) ], Han(y), col="red")
lines(x[-c(1:2, (n-1):n)], Han(Han(y)), lwd=2, col="dark blue")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|