I am using the butter function from the signal package in R to filter my data.
The data is Fourier-transformed (complex numbers) - and I want to filter out specific frequencies (I have a 256Hz sampling frequency, hence a 128Hz spectrum and say I want to filter only data from 4-8Hz).
I find conflicting documentation on what the correct values for W in this function should be:
butter(n, W, type = c("low", "high", "stop", "pass"), plane = c("z", "s"), ...) should they be 4/256 and 8/256? I find it hard to interpret whether my results with 4/256 and 8/256 are correct.
strength <- ftdata low <- 4 high <- 8 bf <- butter(5, low/256, type="high") bfsig <- filter(bf, strength) bf <- butter(5, high/256, type="low") bfsig <- filter(bf, bfsig) plot(f,bfsig, type='l') # Where ftdata is just the output from my Fourier transform. The 5 is the order of the filter.
I just want to know whether the "/256" makes sense here - or should it be 128 because of Nyquist frequency F/2?
Also, any idea why the below does not return the same result as the above?
filt <- butter(5,c(low/256,high/256), "pass") bfsig <- filter(filt, strength)
It should just be a combination of the low and high-pass filters.