# How to be sure that we chose the correct sampling rate in practice?

Let say I perform an experiment and I record data at a given frequency sampling $$F_s$$ and then I perform FFT analysis on these results.

As I do not know the characteristics of the perturbation that I record before conducting the experiment, especially the maximum frequency that exists, I am not able to choose $$F_s$$ according to Nyquist-Shannon theorem.

I am aware that I can increase the sample rate to a specific value, but how can we be sure this value is high enough ? And therefore that we don't have aliasing ?

Thanks

• What are you recording? you have absolutely no idea of the spectral range you're interested in?
– Jdip
Jan 24 at 15:22
• I record the motion of a very flexible structure (we could compare to a flag) when a fluid is circulating around it. I consider the fluid motion like a forced excitation on this structure. Depending on the perturbations in side the fluid, the structure will have different motions
– booo
Jan 24 at 15:51
• Right. And are you interested in the motion of the flag up to $1 \texttt{GHz}$? or is it safe to say you'd be ok with a smaller range of analysis?
– Jdip
Jan 24 at 15:55
• Ok I see your point, I actually expect that the motion of the flag I am interested in is below 1 kHz. But I also expect to be technically limited by my sensor with a highest sampling rate of 1 kHz. Hence, imagine I can not upgrade my sensor, I was wondering if I see some peak around, let say at 400 Hz, how can I be confident that it is a real peak ? (not aliasing)
– booo
Jan 25 at 8:24
• Well, if your highest frequency of interest was $1\texttt{kHz}$ you'd actually need to sample above $2\texttt{kHz}$ to avoid aliasing. I suggest you go with what @DanBoschen suggests: use the highest sampling rate you can achieve, with an appropriate anti-aliasing filter to prevent aliasing. If that highest sampling rate is $1\texttt{kHz}$, you won't be able to see any frequency content above $\approx 400 \texttt{Hz}$, but at least you'll be confident you're not seeing aliased content (or very little).
– Jdip
Jan 25 at 10:09

If the signal bandwidth is not known (and spectral characteristics in general) and test equipment such as a spectrum analyzer is not available, then my recommendation is to sample at the highest rate possible and importantly ensure that a properly designed analog anti-alias filter is included prior to digital sampling. (This may be built into the sensor but don’t assume that). With that, review the spectrum that is available to observe digitally (that which would pass through the anti-alias filter), to then see if lower sampling rates are possible (if there is a motivation to sample lower given lower power and resource requirements with having a lower rate). In all cases, the sampling rate should be at least twice the signal bandwidth plus room for a realizable transition band in the anti-alias filter, up to the limits of analog input BW and sampling rate of the A/D converter.

Choose a capture time based on the desired frequency resolution: The resolution bandwidth of the measurement in Hz is the inverse of the time duration of the capture.

The anti-alias filter combined with the analog input bandwidth of the A/D converter is critical for the control of aliasing: a primary consideration for aliasing is the bandwidth of the Signal+Noise at the input to the A/D converter which is set by an anti-alias filter. The effect of noise folding is often overlooked by those first working with data converters but will be a significant source of noise floor and therefore SNR degradation if not carefully considered. Ultimately sample at the highest rate possible to review an unknown spectrum but ensure the anti-alias filter is designed to avoid spectral aliasing for that given sampling rate (or when we can’t control or change the filter, ensure the sampling rate is high enough to avoid aliasing - for that I have included a link further below that already details the filter and sampling rate requirements).

To be certain that you don’t have aliasing, this is a matter of the anti-alias filter in the analog domain just ahead of the digitizer; regardless of what sampling rate is chosen. The question of the sampling rate together with the anti-alias filter and analog input bandwidth of the A/D converter is a matter of what spectral region we want to capture.

For instance, if we want to capture a signal with spectral energy from DC to 30 MHz, and our anti-alias filter can pass this spectrum with minimum distortion, and then also reject everything above 50 MHz to be below our concern of aliasing effects, then we can safely choose a Nyquist frequency mid way between these frequencies and not suffer from aliasing. That said, in this case the Nyquist frequency would be 40 MHz and therefore the sampling rate is at least 80 MSps.

Point is what is feasible / available for the analog filter design is critical to answering this question, as well as the maximum available sampling rate and analog bandwidth of the digitizer used.

(To mention as well: bandpass and under-sampling is also quite feasible when a bandpass signal is to be captured and this would necessitate a bandpass analog anti—alias filter).

• Ok I didn't think about it this way, but you're right. How ever I have digital sensor, so I'm not sure this solution works in my case. I will directly be limited by the sampling rate of the sensor, right ?
– booo
Jan 25 at 8:27
• This answer appears to say that any $F_s$ works as long as there's an appropriate lowpass? I don't follow? Jan 25 at 11:00
• @OverLordGoldDragon if you don’t know the signal bandwidth then sample at the highest rate possible (as limited by the sensor) and evaluate the spectrum. That is my suggestion and what I would do (and routinely do in practice). If the digitized spectrum is fully occupied then that justifies getting a sensor with more bandwidth. If you know the signal bandwidth (but OP clearly doesn’t) then there are other approaches. Jan 25 at 16:19
• @OverLordGoldDragon got it- let me make that clearer as that was my intention. Jan 25 at 17:23
• @OverLordGoldDragon Thanks for pointing this out. Actually I was maybe unclear, but it was kind of a twice problem/question (don't know signal bandwith + how to avoid aliasing) The answer is now perfect with this clarification
– booo
Jan 26 at 15:47

Multiple options

Theoretical analysis use fluid dynamics or mechanical analysis to roughly determine the frequency content of your signal. What are the main resonance mechanisms and what frequencies do they happen. What's causing your perturbations and what frequencies can this mechanism generate. What are the main damping mechanisms and how do they depend on frequency.

Literature search, industry standards, etc. See if you can find what other people have done in similar situations and why.

Application requirements Example: audio for human consumption. Human's typically can't hear anything above 20 kHz so can cut off all energy above it without loosing information that's relevant to your application.

Trial & Error: Start with the highest sample rate that your setup can support and look at some representative signals. Check your energy and signal to noise ratio across the spectrum. If you still have significant signal energy close to Nyquist you are probably still have aliasing.

In practice you will generally some sort of combination of these until you are confident you understand your signals and application well enough to pick and stick with a single rate.

• I agree with your method. From literature search, I expect to have a maximum frequency Fmax ≈ 0.5 kHz. How ever, for experiments I will have a sensor which has a maximum sampling rate Fs ≈ 1 kHz. If during the experiments I see a peak around Fmax / 2, how can I be confident that it is not aliasing ? From your answer, I understand that I will have to check the PSD value of this peak.
– booo
Jan 25 at 8:42
• Should the PSD of dominant peaks decreases with the frequency ? I mean, if I plot the PSD vs. frequency and I see some peaks : PSD_0 = PSD(fs=f0), ... , PSD_n = PSD(fs=fn). Do we have PSD_0 > ... > PSD_n with f0 > ... > fn ?
– booo
Jan 25 at 8:46
• This answer took thoughts straight out of my head, no more no less. It's so perfect.. Jan 26 at 10:00