# Harmonics below oscillation frequency in the brain

Apologies if this question is trivial, I'm a neuroscientist and would hugely appreciate your help to correctly interpret my analysis.

I am recording EEG signals and am manipulating the brain using light flickering at 10Hz. I then compute the PSD of this signal using FFT of 4s long epochs. I am interested in what the manipulation does to frequencies around 5Hz.

My problem is that my 10Hz stimulation creates an artifact at 10Hz (light induces current flow). I see this clearly in the PSD and I also see higher harmonics at 20 and 30 Hz. My question is whether I should expect this artifact to affect the 5 Hz frequency as well? I don't see a clear peak but I don't fully understand the theory so I'm not sure.

• What is the sampling rate of the captured data you are working with? And have you low pass filtered your data to ensure harmonica above Nyquist don’t fold into your band and appear as other harmonics which may include 5 Hz? Feb 11, 2020 at 12:22
• The signal is digitized at 50kHz, low-pass filtered at 128 Hz and stored at 256Hz. Before analysis, I'm applying a regression-based detrending procedure to remove DC drift (effectively removing 0 -0.5 Hz bands). Could you explain in more detail what you mean by harmonica folding in and how this can be avoided?
– MCK
Feb 11, 2020 at 12:43
• What do you mean by "stored at 256 Hz"? I may need to update my answer with more details if this means that you down-sample to that lower rate. And if you do such down-sampling can you provide the full details of your 128 Hz low pass filter and the implementation of that down-sampler in your question? Feb 11, 2020 at 13:12
• Sorry for being unclear. The low pass filter at 128Hz is a second order biquad filter, the software does not tell the user how the downsampling is achieved.
– MCK
Feb 11, 2020 at 13:28
• What filtering is done in the analog before the 50KHz sampling? Feb 11, 2020 at 13:36

You explain in the comments that the signal is sampled at 50 KHz, then low pass filtered at 128 Hz with a 2nd order biquad filter and then resampled and stored at 256 Hz.

If you weren't prudent with choice of sampling rate and low pass filtering, then the harmonics of 10 Hz could create a component at 5 Hz through aliasing. For example this would occur if you used a sampling rate of 25 Hz: the third harmonic at 30 Hz would fold to the 5 Hz frequency. I explain aliasing in more detail at this post here:

Where should I set my anti-aliasing filter corner frequency for this signal?

That said, there are two prominent mechanisms that could create folding images in vicinity of 5 Hz due to aliasing during this sampling process.

The first would be due to interference components above the Nyquist frequency of 25 KHz prior to the sampling of the analog signal - specifically any frequency components at $$N f_s \pm 5$$ Hz would fold to 5 Hz in your digital signal where $$N$$ is any integer and $$f_s$$ here is 50 KHz. (So 50 KHz +/- 5 Hz, 100 KHz +/-5 Hz are example locations where interference can alias in). To avoid this be sure to use a good anti-aliasing filter and pay particular attention to its rejection around $$N f_s \pm 5$$ Hz with a rejection band around those frequencies that are within the frequency range that you want to maintain to be free of interference for your measurement. Given this is many of orders larger than your 10 Hz interference, it is less likely this is an issue however should not be discounted depending on your measurement sensitivity desired.

The second mechanism, and likely dominant one in this case, is your resampling approach. Resampling to 256 Hz is a fractional rate conversion from 50 KHz and there could be many opportunities to create harmonic folding effects. The actual implementation needs to be reviewed in detail including significantly the performance of the resampling filter prior to decimation. Resampling to 256 Hz is identical to sampling at 256 Hz directly, so any frequency content above the Nyquist frequency of 128 Hz would fold into band. Specifically in this case the frequencies at $$N 256 \pm 5$$ Hz would land at 5 Hz in the digital domain.

Without seeing the actual implementation or ability to change it this would be difficult to predict although certainly can be measured. Induce a 10 Hz test signal with high harmonic content (impulses) and measure the results without your actual device you are measuring connected to assess your measurement noise floor in that condition.

Regardless of aliasing, to be sure that the interference itself does not contain 5 Hz components, I would also recommend analyzing a measurement without your true data source connected (such that you are only evaluating background noise). This would also give you a fidelity of your measurement system in showing you what sensitivity can be achieved, and the related confidence of your results.

• Thank you! It makes sense that fractional resampling is tricky. I think the software may actually sample at slightly different rates to avoid that. If it were not fractional resampling then this second mechanism would be less relevant?
– MCK
Feb 11, 2020 at 15:14
• No still relevant - realize that resampling and sampling are the same thing: when you sample you are simply resampling from an infinite sampling rate so the same aliasing explanation applies. Feb 11, 2020 at 15:44
• OK great that makes sense, and - to summarise for dummies like me - you are saying that this second mechanism may still be relevant even if a lowpass filter was applied because it is not trivial to design an adequate lowpass filter for anti-aliasing.
– MCK
Feb 11, 2020 at 18:57
• It could be trivial and you certainly have enough margin for adequate rejection- the question is was it designed properly with consideration to the 5Hz aliasing frequencies. Since you do not have access to the internal design you need to test as I described to be certain it is not vulnerable to that. Feb 11, 2020 at 19:02