# NOT RUN {
f <- seq(-50,50,by = 1e-2)
fc <- 0.3
BW <- 0.75
par(mfrow = c(2,1))
curve(BP(x,fc = fc, BW = BW, type = "p"), -2,2, ylim = c(-0.2,1)
,main = "Filter weights"
,xlab = "fx",ylab = "w"
)
curve(BP(x,fc = fc, BW = BW, type = "s"), add = TRUE, lty = 2)
curve(BP(x,fc = fc, BW = BW, type = "b"), add = TRUE, lty = 3)
curve(BP(x,fc = fc, BW = BW, type = "g"), add = TRUE, lty = 4)
abline(v = c(fc,fc+BW,fc-BW), lty = 3, col = "grey")
# the corresponding Fourier-Transforms
ty <- c("p","s","b","g")
A0 <- integrate(BP,fc = fc, BW = BW, type = "s",lower = -2,upper = 2)$value
plot(NA,NA,xlab = "x", ylab = "|A|"
,main = "corresponding convolution kernels"
,xlim = 2*c(-1,1),ylim = c(0, sqrt(2)*A0/(length(f)*BW*min(diff(f))) )
)
for(i in 1:length(ty))
{
FT <- spec.fft(y = BP(f,fc,BW,type = ty[i]))
lines(FT$fx * length(FT$fx) / diff(range(f)),Mod(FT$A),lty = i)
}
# }
Run the code above in your browser using DataLab