# A question about the sampling theorem

Let's say I have a signal, containing frequencies up to $30$ kHZ.

I am sampling this signal at $40$ kHz with infinite bit depth (just for theory).

Will I be able to recover exactly all the frequencies up to $20$ kHZ , or is that the signal must only contain frequencies below $20$ kHZ to get the exact magnitudes of the frequencies up to $20$ kHZ ? In other words, will frequencies above $20$ kHZ introduce uncertainty about those below $20$ kHZ ?

• Signal content above 20kHz will be aliased to the 0-20kHz range, so yes it will interfere with what is already below 20kHz before sampling (i.e. it will introduce uncertainty as you say it) Mar 15, 2015 at 18:50

If you sample your signal with $f_s=40\,\text{kHz}$ then the band between 20kHz and 30kHz will be folded back to the band between 10kHz and 20kHz. So aliasing will affect the upper half of your spectrum after sampling, i.e. the band between 10 and 20kHz. The lower band from DC to 10kHz will not be corrupted by aliasing.

To recover a signal from its samples it is sufficient that:

• the signal contains no energy at frequencies at or above half the sampling rate
• that the signal is sampled from $t=-\infty$ to $t=\infty$

If the first condition is not met, you could have aliasing. If the second is not met, the reconstruction of the original signal could be imperfect.

See also discussions at Sampling theorem and signals explained to a mathematician, A question about the sampling theorem, and What is meant by sampling in terms of the sampling theorem? among many other related questions on this website.

If you don't use an anti-aliasing filter, there will be artifacts of the higher frequency present in your signal.

You will theoretically be able to recover frequencies up to 20 kHz (practically a little less than that though). If there is signal above 20 kHz when sampled at 40 kHz, you should apply an anti-ailiasing (low pass 0-20kHz, practically 0-18kHz) filter to the data at the input. Data acquisition units should have this built in.