Feature
Old measurements, new techniques: DSP drives speed and accuracy; coherence saves the day
DSP techniques lead to faster, less costly frequency-response tests and enable the use of a powerful concept, the coherence function, which acts as a watchdog to help identify and quantify common but easy-to-miss measurement errors. Best of all, this watchdog works for free.
By Carsten Thomsen, National Instruments -- EDN, 10/11/2001
To engineers who are used to worrying about the quality and precision of signal generators, the cross-spectral technique for measuring frequency response should come as a welcome relief, because it relaxes the requirements on the signal generators used in the measurements. Drift, amplitude stability, flatness, noise, and distortion become quite irrelevant. The only thing that really matters is that the generator be able to create some semblance of the desired signal, whether it is noise, a chirp, or a transient. As the background material for this article shows, the cross-spectral technique measures the amplitude and phase of the spectra of both the excitation and response signals and thereby corrects for signal-generator errors. (Click here for a PDF version of this background material.) The distortion or noise that a poor-quality generator creates becomes just another part of the excitation signal-a part that the mathematics can handle. Recall that several types of noise, including white noise and transients, are perfectly legitimate forms of excitation, so if the excitation signal contains them, there is no issue. The only type of signals that the math can't handle are alias components (signals that the sampling process shifts from one frequency to another). It's unimportant whether the source of these components is the generator, the UUT (unit under test), or the measuring instrument's ADC, which can create aliases if it lacks suitable input filters. Therefore, you must pay attention to prevent out-of-band signals from reaching the ADC.
The figures dramatically illustrate this phenomenon: All of them show frequency-response measurements using the cross-spectrum technique. The measurement averaging continues from figure to figure, whereas the input signal changes. Figure 1 shows the frequency response using sine-wave excitation. Because a signal is present at only one frequency, the results at all other frequencies are inaccurate. In Figure 2, the excitation frequency has been manually turned up and down, and you can see that the frequency-response function seems to be filled in at these new frequencies. In Figure 3, the generator is switched to square wave, which helps to fill in even more frequencies.
Finally, in Figure 4, the signal consists of broadband chirps, and you see a clean frequency-response plot over the entire range. The clean plot is remarkable because the averaging was not reset, and the instrument remembered the spectra of all the other signals. The effect of the earlier signals is of little consequence, though, because the value of the correlated ratio of the output to the input dominates the result.
A paradox of this result is that, historically, you had to be careful to not create a click or transient when switching a generator from one mode to another. In these tests, however, the click is actually an advantage, because it provides the broadband excitation necessary for measuring the frequency response.
Although this haphazard procedure is not the optimal way to measure frequency response, it does illustrate how you need to revise your way of thinking when you deal with the new world of cross-spectrum-based frequency-response measurements.
Measurement-system requirementsTo make successful frequency-response measurements, the measurement system should comprise two matched ADCs. These units must have stable frequency response and, ideally, should be matched in both gain and phase characteristics. However, you can relax the channel-matching requirement if you measure the relative gain and phase between the channels. That is, apply the same broadband excitation signal simultaneously to both channels, measure the resulting frequency-response function, and then correct for it during the actual measurements. You can also use this technique to enhance the accuracy of already well-matched channels. Assume, for example, that the channels are matched to within 0.1° and 0.01 dB. Then, you can use relative gain and phase measurements to improve this performance by a factor of 10, assuming that you can document that the system has adequate stability:

For these types of DSP-based measurements, it also is important to prevent aliasing errors. You can prevent such errors either by limiting the bandwidth of the excitation signal or by using an ADC that includes appropriate antialiasing filters.
In addition to the risks of noise and nonlinearity in your frequency-response measurements, you know from experience with swept-sine measurements that you must be careful to have a long enough sweep time to accurately characterize all peaks and valleys. As previously mentioned, the dwell time (T) of a sine-wave sweep must be greater than the reciprocal of the bandwidth (B) of the resonance you want to measure:

How much greater T must be depends on the characteristics of the resonance, so experimenting with different sweep times is always important. This same approach applies to broadband excitation. Here, the dwell time is the total record length of the FFT. For example, for a 10-Hz bandwidth, your record length must be at least 100 msec. However, this rule of thumb does not give a quantitative way of ascertaining the accuracy of a given measurement. Fortunately, several useful tools are available.
One technique to help validate your measurement is to look at the Nyquist plot (imaginary versus real) of each resonance. In Figure 5, Figure 6, and Figure 7, you can see the discrete samples of the circle that represents the resonance you are trying to characterize. If the frequency resolution is inadequate, you will see a circle with just a few points, clearly distorting its size and shape. You can increase the frequency resolution until the circle is properly characterized, but the frequency-response function gives you another way to catch this type of problem.
Coherence to the rescueThe coherence function is a powerful technique that helps qualify your measurement. This function requires no new equipment or extra expense; it comes for free when you measure the frequency-response function using the cross-spectrum method.
Coherence is a measurement of how noise-free your system-including the test equipment-is. Recall that the cross spectrum is basically the vector product of the input and output spectra. These spectra are then averaged over multiple measurements to see whether the vectors line up (that is, have the same angle). Averaging reduces signal components not aligned with the main vector, so you get a cross spectrum with less undesired noise (Gxy).
At the same time, you multiply the averaged power spectrum of the input Gxx and output Gyy to compute a cross spectrum that includes all of the measurement's undesired noise. (Recall that there is no noise reduction because no correlation is computed.) The noisy cross spectrum is Gxx Gyy.
Then, by taking the ratio of the clean cross spectrum Gxy to the dirty cross spectrum Gxx Gyy, you can get a measurement of the measurement's cleanliness. (These equations are an implicit function of frequency.)

More precisely, this function is called the Coherence function (γ2) and is written as:

In the limiting case of a noise-free system, the numerator and denominator are equal, and the coherence equals unity. By definition, because of the noise, there will always be more signal in the denominator of the above equation than in the numerator. Hence, the coherence can never exceed unity. Looking at it another way, you can view the coherence as a frequency-domain statistical 'correlation,' and the correlation coefficient can never exceed 1.
Now, an equation doesn't care where the noise comes from. Therefore, the coherence picks up all error sources that are attributable to uncorrelated signals. Examples include noise on the output that is uncorrelated with the input, errors caused by inadequate frequency resolution or incorrect weighting windows, distortion, crosstalk, aliasing, and errors resulting from delay between channels (which causes the loss of part of the received signal).
A series of coherence examples provides a better feel for this function. Figure 8 shows a perfect coherence of 1.0, but you have computed the average only once, so, by definition, the coherence provides no information. (Remember that if you perform only one experiment, the correlation is always 100%. That is, the coherence is 1.)
Figure 9 shows how coherence drops outside the passband because of low SNR. This system has noise floor about 80 dB less than full-scale. In addition, coherence drops dramatically because of inadequate frequency resolution at the two resonance peaks. The two notches in the coherence function show how the function picks up errors in the measurement and warns that something is wrong.
Figure 10 shows the same system but with the noise source physically removed. Notice how the coherence outside the passband dramatically improves, but the problem with the resonances is the same. In addition, the lower level part of the frequency-response function is noticeably cleaner.
Resonances and notchesHigh-Q filters present significant challenges in achieving high-accuracy measurements. In the measurements in the previous section, the coherence function indicated that something was dramatically wrong at the resonances. Good intuition points in the direction of inadequate frequency resolution in the measurement. Another way of verifying this idea is to look at the Nyquist representation of the frequency-response function. In it, the gain is the vector length, and the phase is its angle. The Nyquist plot in Figure 5 shows two resonances, each 'quantized' (that is, sampled in the frequency domain) with about five samples, as clearly indicated by their jagged nature. For reference, the figure shows the corresponding coherence function.
Figure 6 repeats the measurement with four times the frequency resolution, or 12.5 Hz. Note that the magnitude of the resonance peaks has increased (that is, improved) dramatically, and the drop in the coherence is much smaller, indicating that increasing the frequency resolution was appropriate.
However, the result is still wrong. To arrive at the correct result, you simply use an iterative approach, just as you would when changing the sweep rate of a network analyzer. You keep reducing the resolution bandwidth until the gain of the resonances stops increasing.
Figure 6 and Figure 7 show this process; the resolution increases by a total factor of 100, giving a resolution bandwidth of 0.5 Hz. Now the coherence drop at the resonances is essentially zero, and the Nyquist plot shows that the resonances indeed have the ideal circular shape, with a gain factor of unity.
The coherence-watchdog capability is fascinating, because it interprets the inadequate resolution as a lack of correlation between the input and the output. In reality, some energy is lost because the record length is too short to fully capture the entire decay of the resonance. These effects are a gross form of nonlinearity, and the coherence function picks them up, although the coherence function knows nothing about frequency resolution. For reference, Figure 11 shows the original frequency-response function, measured with 50-Hz resolution, and the correct frequency response, measured with 0.5-Hz resolution. Notice the magnitude of the error that results from improper resolution.
When using computer-based instruments, you can apply a powerful trick to automate the time-consuming process for finding the correct frequency resolution. Because of its large memory and processing power, you can easily program a PC to perform all of the four computations in parallel based on the same data streams. This approach corresponds to having four parallel frequency-response analyzers on the PC computing 2k-, 8k-, 20k, and 200k-point FFTs in parallel. The extra computational load to do four calculations is minimal compared with the demands of the largest transform. Thus, you need not repeat the measurement again and again; you can simply monitor each of the four results as they proceed in parallel and pick the optimum one.
Validating accuracyAs with all measurements, there are two types of error: bias, or systematic, error, which skews the measurement a particular direction, and random error, which varies from time to time, but centers on the mean value (equal to the correct value plus the bias).
You can best remove instrumentation bias errors by carefully calibrating the entire system. The technique of applying the same broadband test signal to both channels and measuring the relative response is extremely powerful, because it enables you to readily correct for both gain and phase differences at all frequencies.
Assuming that your measurement system has good stability, this technique can often reduce bias errors by a factor of 10 or more. Because both gain and phase are relative measurements, only the stability of these channels relative to each other at each frequency of interest limits the accuracy of your measurement. You can readily verify this stability by making a sequence of measurements over a longer period of time and noting the drift under a given set of environmental conditions. Again, you need not worry about having a state-of-the-art, stable generator, because you are exciting both channels with the same broadband signal.
In addition, inadequate frequency resolution is the most common cause of significant bias errors. You must carefully set the frequency resolution to adequately characterize the measurement's peaks and valleys. Keeping an eye on the coherence function or watching the jaggedness of the Nyquist plot helps you to choose the correct resolution.
You can use the following relationship to derive (with 95% confidence) the random error in the gain of the frequency-response function (using random-noise excitation) based on the coherence function and the number of averages:

This expression indicates that a high coherence (that is, a good SNR) gives a low error, but you can improve the estimate's accuracy by increasing the number of independent averages (ηD). This approach quickly reaches a point of diminishing returns, however, because of the square-root sign. For example, if you have a coherence of 0.9 and you average more than 10 measurements, the random error is 7.5%. Although you can achieve the same random error with a poor SNR, for example with a coherence of 0.1, you would have to average 810 measurements. In other words, the measurement would have to be approximately 80 times as long. From this example, it is clear that doing everything you can to improve the SNR is the best way to speed the measurement.
From the above calculations, it is clear that the random error depends on noise at the system output. This noise includes noise generated by the UUT, as well as noise in the input amplifiers and ADCs and noise picked up in the cables between the UUT output and the receiving channels. Noise at the system input is part of the excitation signal; it generally passes through the system and is measured by both channels.
It is useful to relate the value of the coherence function to the more familiar SNR. Determining the relationship is quite simple because the terms in the above equation, which include the coherence terms, basically provide the ratio of the noise to the signal. These terms are more commonly expressed in the reciprocal form, that is, as the SNR:

Importantly, this relationship shows the SNR not only of the physical circuit but also of the circuit plus the measurement errors. Inadequate frequency resolution (an error in the measurement system) therefore shows up as excessive noise in the neighborhood of a resonance. This effect is probably one of the most novel things about the coherence function: it serves as a watchdog over many types of measurement and system errors. In addition, the function's extra computational cost is small because it is based on values already computed to derive the frequency response. The coherence calculation takes just a quick postprocessing operation that requires only a few milliseconds. You can perform the calculation after the measurement is complete, or you can monitor the coherence function during the measurement to check for system errors.
A common fallacy is that a low coherence value means that you cannot make an accurate measurement. Although this statement is true for low coherence values that result from inadequate frequency resolution, it is not the case for measurements in noisy systems. In such systems, averaging according to the above formulas gives correct results (within the confidence limits indicated), assuming that you have time enough to make the measurement and that the system does not drift significantly during the measurement.
Finally, it is important to note that the attributes enumerated for the coherence function apply only to systems with nonrepetitive excitation. For example, if you use a periodic random signal or a chirp in a very-low-noise system, the coherence function gives you a result of 1 at all frequencies, because you are, in essence, repeating precisely the same experiment many times. If the system does have some background noise (which is the case for most real systems), the coherence function comes alive again and helps to identify many of the issues this article discusses.
Cross-spectrum techniques can increase the measurement speed of the frequency-response function and dramatically improve its accuracy. Although it may sound too good to be true, this technique also reduces the requirements on the signal generator's quality and allows the use of measuring hardware with only moderate flatness and channel matching. Broadband excitation coupled with FFT-based measurements provides a speed increase by simultaneously measuring all frequency components. The technique also exhibits good noise rejection, because the measurement is made using the FFT's frequency selectivity. You obtain additional noise rejection using cross-spectral averaging, which makes possible measurements in noisy and nonlinear systems. Finally, the coherence function helps to validate the quality of the measurement by indicating the system's SNR and hence the amount of averaging necessary to achieve the desired accuracy.
The background material for this article, including a tutorial on cross-spectrum frequency-response measurement, shows how DSP coupled with parallel signal generation speeds frequency-response measurements. To read this material, click here for a PDF-only version.
| Author Information |
| Carsten Thomsen, who lives and works in Horsholm, Denmark, is a consultant on engineering and management issues for National Instruments in Austin, TX. He received a BA in math and physics in 1971 from Andrews University (Berrien Springs, MI). Thomsen was also a coinventer of NI's PXI CompactPCI-based modular-instrumentation standard. His interests include computers, audio, digital video, and travel. |
|














