I used Python/scipy to create an input data (sinewave with frequencies {600,1200,1800,2400,...,9000}) and sampling at 10000Hz. A lowpass filter is created using butter(10, 4000/(10000/2), 10000, btype='low'). After filtering the filter using lfilter function, I plotted the FFT of the input data the filtered data, I found some extra frequencies in the FFT graphs. I think it should show the frequencies at {600, 1200,...,4800}. Where are these extra frequencies from? and how to remove them?
1 Answer
The issue is that you're violating Nyquist which requires that the sampling rate be at least twice the rate of the highest frequency in the signal. In your case all of the sines that you're generating above 5000 Hz are folding back. For example, a 5100 Hz tone (5000+100) would fold back to 4900 Hz (5000-100) and so on.
The 1 kHz tone you highlighted is the 9 kHz tone you generated, but folded back. If you look at your graph more closely you'll notice that this tone is in the unfiltered signal and is in no way related to the filtering.
-
$\begingroup$ Thank you very much for your answer. But what if the fastest sampling rate of my audio recorder is, for example, 10000 Hz and I want the audio signal between 0 - 2000 Hz. But there are noise frequencies at 7000 and 20000 Hz. How do I remove these frequencies (7K and 20K) if the sampling rate is still at 10K Hz? $\endgroup$– kumpeeDec 3, 2019 at 7:03
-
$\begingroup$ @kumpee It is physically impossible for there to be any signal energy beyond half the sampling rate. Even if you had higher frequencies at the analog input of your AD converter, it should have filtered them out. Even if it hadn't they wouldn't be above Nyquist once you reach digital, rather they would be aliased down. $\endgroup$– jaketDec 3, 2019 at 7:58