Displaying 1 result from an estimated 1 matches for "myconvolve2".
Did you mean:
myconvolve
2000 Jan 28
0
convolution bug (PR#408)
...}
else
{
h <- c(h,rep(0, nx-1))
x<-c(x,rep(0,nh-1))
}
x <- fft(fft(x) * fft(h), inv = TRUE)
Re(x)/length(x)
#I am not sure about this, the R IFFT is weird
}
What "circular" convolution should do is just
eliminate the zero-padding:
myconvolve2<-function (x,h)
{
#no padding, circular convolution
nx <- length(x)
nh <- length(h)
x <- fft(fft(x) * fft(h), inv = TRUE)
Re(x)/(nx)
}
I suggest that you create two functions, convolve() and correlate(), and get
rid
of the conj argument in convolve().
-.-.-.-.-.-.-.-....