I have some recorded signal with 100Hz sample rate. I want to filter out 60Hz frequency from the signal. I am using the butter()
filter from the signal
package in R. But it does not allow us to filter out frequencies greater than the Nyquist frequency. So when I try to apply the Butterworth filter
butter(5,W=c(58,62)/100*2,type="stop")
I get the
Error in butter.default(5, W = c(58, 62)/100 * 2, type = "stop") :
butter: critical frequencies must be in (0 1)
The manual page for Chebyshev's filters mentions the same requirement on the filtered frequencies.
Can I do anything here without upsampling the signal? Which other filters may I use?
You can't filter out the 60Hz frequency, because there's no such frequency in the sampled signal, due to the Nyquist sampling theorem.
However, what you can find in the sampled signal is an alias of the 60Hz frequency. It's located at 40Hz, because of the folding effect at 50Hz (half the sampling rate). You can filter out this frequency, but you will lose the information of the original signal 40Hz frequency too.