Home | Forum | DAQ Fundamentals | DAQ Hardware | DAQ Software Input Devices | Data Loggers + Recorders | Books | Links + Resources |
AMAZON multi-meters discounts AMAZON oscilloscope discounts One of the most critical factors confronting users of data acquisition systems and A/D boards is the question of how frequently should an analog signal be sampled to be able to represent and reconstruct the input signal accurately. How fast should the A/D board be able to sample the data? AMAZON multi-meters discounts AMAZON oscilloscope discounts F.5.1 Nyquist's theorem Nyquist's sampling theorem states that: An analog band-limited signal that has no spectral components at or above a frequency of F Hz can be uniquely represented by samples of its values spaced at uniform intervals that are no more than 1/2 F seconds apart or sampled at a frequency of no less than 2 F Hz. The maximum sampling period, T=l/2 F, is known as the Nyquist interval, while the minimum sampling frequency, corresponding to this period, 2 F, is known as the Nyquist sampling frequency, or rate. Sampling at a rate higher than the Nyquist rate is called oversampling. This is routinely performed where it's essential to recover a true replica of the signal being sampled. When a signal is sampled at less than the Nyquist rate, this is known as undersampling and can lead to erroneous results. AMAZON multi-meters discounts AMAZON oscilloscope discounts F.5.2 Aliasing To intuitively understand what happens when a signal is oversampled compared to a signal that is sampled less than the Nyquist sampling rate, consider ill. F.13. d) Oversampled signal adequately reconstructed b) Aliasing caused by sampling at less than the Nyquist sampling rate a) DC alias caused by sampling at half the Nyquist sampling rate c)Sampling at the Nyquist sampling rate ill. F.13 Effect of sampling rate on the reconstructed input signal ill. F.13 (d) shows a signal that is sampled at a frequency well above the Nyquist sampling rate. In this case, the information contained in the signal, including its shape and frequency, can be correctly reproduced. If the sampling rate is reduced to below the Nyquist sampling rate, that is, the sample points are too far apart, then the input signal is misrepresented by what appears to be a much lower frequency signal. This phenomenon is known as aliasing and is demonstrated in ill. F.13 (b). In ill. F.13(a), the input signal is sampled at half the Nyquist sampling rate, which is the same frequency as the frequency of the signal itself. The reconstructed waveform appears as a DC signal. When the input signal is sampled at the Nyquist sampling rate, as shown in ill. F.13(c), the reconstructed signal has the correct frequency but incorrectly appears as a triangular waveform. Where undersampling occurs, the frequency of the reconstructed signal appears to be much lower, lying between DC and the Nyquist frequency. Theoretically, the effects of aliasing are more easily understood by looking at the frequency spectrum of an analog signal. Without detailing the complex mathematical descriptions and frequency analysis required, it can be shown that a time varying band-limited signal can be equally represented by its spectrum in the frequency domain. ill. F.14(b) shows the frequency spectrum of the band-limited signal shown in ill. F.14(a). If the time varying signal is sampled using a very narrow series of square wave pulses, as shown in ill. F.14(c), then the frequency spectrum of the sampled waveform is the original signal with exact replicas of itself spaced about multiples of the sampling frequency. ill. F.14(d) illustrates the frequency spectrum of a signal that is sampled at exactly twice the maximum frequency of the original signal, showing that the replicas of the original signal just touch. Oversampling the original signal, as shown in ill. F.14(e) separates the input signal bands by a wider frequency. This is shown in ill. F.14(f). Undersampling narrows the separation between the bands so that they fold over each other and result in aliasing, as demonstrated in ill. F.14(g) and ill. F.14(h). Where this occurs, the resultant signal appears as an aliased signal between DC and the Nyquist frequency, and can't be distinguished from valid data. ill. F.14 Demonstrating the effect of aliasing in the frequency domain a) Time-varying band limited signal b) Frequency Spectrum c) Signal sampled at Nyquist rate d) Spectral replicas generated when sampling at Nyquist rate e) Over sampling a time varying signal f) Spectral replicas generated when over sampling g) Under sampling a time varying signal h) Spectral replicas generated when under sampling Consider a band-limited signal, which contains three sinusoidal waveforms, a 25 Hz wave form representing the wanted signal, a 50 Hz signal, which is unwanted mains hum, and an unwanted high frequency noise signal at 260 Hz. ill. F.15(a) shows the frequency spectrum of this band-limited signal. ill. F.15 Frequency spectrum of original and sampled signals The frequency spectrum of the reconstructed signal, sampled by an A/D board at fs = 80 Hz is shown in ill. F.15(b). Frequencies below the Nyquist frequency, fs/2 = 40 Hz, in the original signal spectrum, appear correctly. However, replicas of the signal frequencies above the Nyquist frequency are reproduced about multiples of the sampling frequency and therefore appear as aliases. A2 and A3 are aliases of the original signals F2 and F3 respectively. The alias frequency of any signal frequency can be simply calculated by the formula: Alias Freq = ABS (closest integer multiple of sampling frequency - signal frequency) Alias A2 = [80 - 50] = 30 Hz Alias A3 = [(3)80 - 260] = 20 Hz In this example, the resulting aliases are very close to the frequency of the signal of interest and would be very difficult to remove. Once an aliased signal has been introduced, it's almost impossible to remove it by digital filtering methods. F.5.3 Preventing aliasing One method of preventing aliasing is by filtering the input signal with a low pass filter with a cutoff point set to the Nyquist frequency or half the sampling rate. This type of filter is known as an antialiasing filter. A perfect antialiasing filter would simulate the brick-wall response of an ideal low pass filter, as shown in ill. F.16, rejecting all unwanted frequency components above the Nyquist frequency. Thus, by using this filter the input signal could be sampled at twice the Nyquist rate without aliasing. ill. F.16 Ideal low pass filter response Unfortunately, real filters don't simulate ideal filters, and in fact exhibit some attenuation (dB/octave) near the cutoff frequency. As shown in ill. F.17, this roll-off may not be steep enough to totally eliminate all the higher frequency components. Although attenuated, these higher frequency components can, and will, fold down to the signal band of interest. ill. F.17 Practical low pass filter response Therefore, to accommodate the filter cutoff frequency and roll-off, the sampling rate should be increased. Using simple passive antialiasing filters, it's recommended that the sampling rate be a minimum of about five times the cutoff frequency. Non-periodic wave-forms can be oversampled by about ten times. High performance antialiasing filters with very steep roll off near the cutoff frequency, as shown in ill. F.18, allow the signal to be sampled at two to three times the filter cutoff frequency. ill. F.18 Steep roll-off antialiasing filter F.5.4 Practical examples A common data acquisition application is machine vibration analysis. All machines resonate at certain frequencies, both under normal operation and when driven by an external source. In this example, strain gauges were placed on the machine and the output signal sampled, digitized (yielding a time domain plot, see ill. F.19(a) and converted into the frequency domain (e.g., using FFT). The spectrum resulting from sampling at 50 kHz is shown in ill. F.19(b). It has two resonant frequency peaks, one around 4 kHz, and another slightly above 5 kHz. The machine vibration analyst knows that the 4 kHz component corresponds to the machine's rotational speed, but the 5 kHz component is a mystery. Passing the input signal through a 10 kHz cutoff antialiasing filter with subsequent re-sampling, yields the spectrum in ill. F.19(c), clearly revealing the 5 kHz component to be an alias. Indeed, sampling the original signal (without the antialiasing filter) at 100 kHz yields the spectrum in ill. F.19 (d) and shows that an actual frequency component, present in the vibration signal, of 45 kHz has been aliased down to 5 kHz when sampled at 50 kHz. ill. F.19 Aliasing due to undersampling In the example of machine vibration analysis, the frequency components were clearly visible and constant. However, in the case of speech digitization or speech analysis, the desired signal consists of many frequency components that vary quickly and unpredictably. An application may require spoken messages to be digitized and stored for later playback. As most speech is composed of frequency components below 5 kHz, digitizing the in-coming signal at 10 kHz appears to be adequate and places only low demand on memory usage. Unfortunately, an attempt to digitize a message signal from a microphone in this way resulted in the message so buried in extraneous hums, pops, and whines that it could hardly be used. The frequency spectrum of the sampled signal is shown in ill. F.20(a). In the assumption that high frequencies present on the input were aliasing down, a 5 kHz, antialiasing filter was put in place, leading to the spectrum in ill. F.20(b). The spectrum shows little difference from the unfiltered signal's spectrum. Increasing the sample rate (to 100 kHz, ill. F.20(c)) shows why: although attenuated, components above the filter's cutoff point are still present and do alias down. The filter had a roll-off of 24 dB/octave and the real-world properties of the filter allowed the attenuated high-frequency components to fold down into the band of interest. Practically, solutions are using filters with greater roll-off (reducing the magnitude of high-frequency components that might alias) or sampling at a higher rate (frequencies in the new sampling band don't fold down). ill. F.20 Many aliases combined with a speech signal It could be assumed that aliasing is a phenomenon associated with high frequencies, and that low frequencies (such as thermocouple temperature signals) are immune to this effect. Temperature changes so slowly that the input signal is almost DC; it seems therefore reasonable to sample it extremely slowly and not be concerned with frequency analyses. However, if the input signal contains a noise spike as shown in ill. F.21(a), the resulting spectrum results in a noise floor around -60 dB, shown in ill. F.21(b). This is because an impulse spike in the time domain spreads itself out evenly in the frequency domain. Thus, when sampled at a low frequency, the high-frequency components of the noise spike alias down and add to the low frequency components. The extra energy of these added frequencies causes the temperature application to oscillate. If a low pass filter is used, the spike - with its equivalent high-frequency components - is removed (as shown in the time domain in ill. F.21(c). The spectrum corresponding to this (ill. F.21(d)) now has a noise floor of -80 to -90 dB, which does not affect the readings obtained by the A/D board. ill. F.21 A spike causes wideband aliasing NEXT: Sampling techniques |
Updated:
Friday, February 18, 2022 12:44
PST