1
$\begingroup$

I need to measure (with high accuracy) magnitude and phase of some intermodulation products generated by a non-linear analogue device (black-box). The input signal consists of two tones at very close frequencies, equidistant from a reference f0.

For example, if f0=1 KHz, the two tones will be at f1=990 Hz and f2=1010 Hz, with the same magnitude and phase. In output, due to non-linearities, intermodulation products will be created in the ‘surroundings’ of the ‘virtual’ harmonics at 1 KHz, 2 KHz, 3 KHz etc. In the case of tones around 1 KHz, tones will be created at frequencies: 970, 950, 930, ... Hz and 1030, 1050, 1070, ... Hz, due to distortion orders 3, 5 and 7 respectively.

I am interested in high-precision detection of magnitude and phase of these products, and especially for those described ‘around’ 1 KHz. The signal is sampled at a high frequency in output (192 KHz or more) and no real-time calculation is required.

To avoid spectral leakage phenomena, it is necessary to use window functions, but these alter magnitude and phase values of the components. The Flat Top window has a high precision for the magnitude, but I have not found documentation on how to accurately detect the phases. Are there more appropriate windows/calculation methods?

$\endgroup$
4
  • $\begingroup$ Can the measurement frequencies be phase locked to your sample clock ? $\endgroup$
    – Hilmar
    Commented Sep 4 at 16:29
  • $\begingroup$ How can signals at 990 Hz and 1010 Hz be said to have the same phase? $\endgroup$ Commented Sep 4 at 17:47
  • $\begingroup$ The same phase of tones at 990 and 1010 Hz are referred to the input signal that I can set. $\endgroup$
    – Pino
    Commented Sep 4 at 18:09
  • $\begingroup$ The flow is: Discrete input signal -> DAC -> DUT -> ADC -> Discrete output signal. ADC/DAC is the same sound card of high quality. $\endgroup$
    – Pino
    Commented Sep 4 at 18:16

3 Answers 3

1
$\begingroup$

My approach to this is as follows (just due to both its simplicity, high accuracy and applicability to the measurement of any tones regardless of sampling rate and frequency relations):

Yes use windowing. I like the Kaiser window due to its excellent time-bandwidth properties, and that you can easily trade resolution bandwidth (how closely we can resolve individual tones) with dynamic range (how much difference in dB you can see a weaker tone next to a stronger tone that is beyond the resolution bandwidth).

To measure the tone, both magnitude and phase (relative to your sampling clock which serves as the phase reference) with very high accuracy, do the following:

Ensure the capture duration in time is long enough to meet the resolution bandwidth requirement. If there was no further windowing applied (native rectangular window), the resolution bandwidth in Hz (RBW) otherwise referred to as equivalent noise bandwidth (ENBW),is simply the inverse of the total capture time in seconds - windowing stretches this out (see my answer to DSP.SE# 94702 for the exact formula for RBW for a given window) but a 1.5 to 2x increase is a reasonable assumption covering most practical cases. Therefore, if you want to resolve tones that are spaced 1 KHz apart, the capture duration needs to be sufficiently larger than 2 ms. (The longer the better as long as the signal is sufficiently stationary over this duration, this is just setting the minimum requirement). Sampling at 192 KHz to get 10 ms of data (for example) is only 1920 samples, so this could easily be much longer.

Window the captured signal over that total time duration.

Zero pad the resulting windowed signal out to 10x its length (or longer) and then take the FFT (basically in MATLAB, Octave or Python scipy.signal, just specify a longer length for the FFT and it will do the zero padding. This results in minimizing the scalloping loss and any narrow band tone that is individually within the resolution bandwidth of the measurement will be accurately captured both in frequency and magnitude.

Divide the FFT by the sum of the window, and the resulting magnitude of the two peaks in the FFT for every sinusoid will be accurately represented according to the two exponential tones in Euler's formula as given below (representing the magnitude and starting phase of the individual exponential tones):

$$A\cos(\omega t + \phi) = \frac{A}{2}e^{(j\omega t + \phi)} + \frac{A}{2}e^{(-j\omega t - \phi)}$$

I don't think it gets easier than this, and the accuracy is only limited by how much you zero pad (which does the interpolation) and what the SNR is for that tone within the resolution bandwidth of the measurement.

Note: I want to stress how important the windowing is with this approach (and of little consequence to the SNR of the result). Try what I suggest without windowing when measuring low frequency tones or tones near Nyquist. Without windowing the positive and negative frequency tones will interact and degrade the result and windowing with the sidelobe reduction significantly reduces that error, quickly to negligible results. The resulting method is then robust and independent of frequency for generalized measurement cases.

For further details on how to accurately measure tones versus how to accurately measure noise densities see DSP.SE #87723 . Also I will be presenting this very topic in much more detail at the 2024 DSP Online Conference that will take place at the end of next month!

$\endgroup$
5
  • $\begingroup$ I tried your procedure with a synthesised test signal: f1=995KHz, f2=1005Hz, level=-6dB and products distant of +/-10Hz, at the level of -40, -60 and -80dB. The signal is sampled at 192 KHz for 2 seconds. I then applied the Kaiser window (140 dB attenuation), followed by 10x zero-pad and then FFT divided by the window area x 2. Well, for modules, the accuracy is high (< 0.02 dB). Unfortunately, the error is high for the phase, over 15°. I tried other combinations of the previous parameters, but without significant improvements. Any suggestions? $\endgroup$
    – Pino
    Commented Sep 6 at 15:12
  • $\begingroup$ After several attempts I found the parameters that reduce the phase error for the signal described to less than 2°: the zero-padding must be 100x (with 50x the error doubles). This implies a FFT on about 16 MSamples. The differences between the windows decrease: the best ones seem to be Kaiser and FlatTop. By reducing (increasing) the distance between the tones the errors increase (decrease) at the same parameters. $\endgroup$
    – Pino
    Commented Sep 6 at 16:53
  • $\begingroup$ Nice yes you can get it down to any precision as limited by your SNR (and stationarity of your signal for purpose of taking longer captures which reduces the resolution BW and therefore increases SNR assuming it is stable). The rms phase error in radians for small angles is $10^{(-SNR/40)}$ (assuming equal parts phase and equal parts amplitude). I agree Kaiser would be best. If rms phase alone SNR is 20Log10(), for example with 2 degree rms phase it you are at the limit of what you can do- the SNR is 45 dB for that measurement. To resolve close tones you need to increase duration. $\endgroup$ Commented Sep 6 at 17:38
  • $\begingroup$ An update. Accuracy is greatly increased if a cubic interpolation between the bins involved is introduced in the tone extraction downstream of the DFT. This increasing the window duration to a few seconds (at 192 KHz) and the zero pad to only 16x. The error with these parameters is < 0.002 for magnitude (in dB) and < 0.02 for phase (in degrees, referring to fundamentals), for tones 10 Hz apart. $\endgroup$
    – Pino
    Commented Sep 9 at 10:21
  • $\begingroup$ @Pino thanks for the helpful comment. I think what you mean is you can zero pad less to achieve the same accuracy if you introduce polynomial interpolation (zero padding is an interpolation approach). Further, you can even extend this further by using higher order interpolation techniques beyond the 3rd order cubic. The idea of using zero padding alone is in its simplicity but it certainly isn’t the only way to interpolate nor the approach that would require the minimum resources $\endgroup$ Commented Sep 9 at 14:31
0
$\begingroup$

I need to measure (with high accuracy) magnitude and phase of some intermodulation products generated by a non-linear analogue device (black-box). The input signal consists of two tones at very close frequencies, equidistant from a reference f0.

Tough! Nonlinear systems can be non-invertible on measurable amounts of input, (linear systems only for points, or everywhere, but the 0-system is easily identified) so, in general it's impossible to guarantee that you can fully characterize the system: for example, a linear system can be characterized without input an extremely high value into it. A nonlinear system might behave such and such until a threshold input is reached, and then completely different afterwards (just as a transistor can look like an ohmic resistor, until you hit the point at which the exponential nature becomes visible).

So, the first thing as usual to identify something is to set yourself up with a parameterizable model into which you want to shape your idea of the system.

I think you're aiming for a Volterra series there, but I'm not sure – what you describe about the harmonics might already be described with a pure Taylor series (memoryless) system, but then why mention frequencies and phases?

The rest of your question, I'm afraid, seems a bit speculative to me. I'm not sure how windowing comes into play here – you're trying to match a model to something containing only harmonic input, which suggests that windowing might destroy information. I honestly don't know, though – you don't supply us with your mathematical model!

Thus, start with writing down a math equation that says output = function of input, where function has a lot of parameters; then you can adjust these parameters to shape the function to behave like your observed system.

$\endgroup$
2
  • $\begingroup$ My question concerns the existence of methods to accurately measure magnitude and phase of a signal that presents itself in the manner described. Given the presence of multiple non-harmonic tones, the use of window functions is common practice. The fact that it is generated by non-linearities can be read as information to better frame the context, but I would not like to address the issue of identifying a non-linear (Volterra or block-oriented) model, which is very large and complex. $\endgroup$
    – Pino
    Commented Sep 4 at 18:07
  • $\begingroup$ exactly! but here's the thing: your approach to windowing makes sense when you actually want the spectrum, but you're in need of an estimate of phases and amplitudes of individual frequencies; so estimate these precisely (with a parametric estimator, or a DFT of an observation length that is a multiple of the period at that frequency), and don't worry about the effects you'd try to counter with a window $\endgroup$ Commented Sep 4 at 23:02
0
$\begingroup$

it is necessary to use window functions,

Nope. Not if your test signal generator uses the same clock that drives your A/D converter. You just have to make sure that your frequencies have an integer number of period inside the analysis window.

Let's say you acquire about 1s worth of data at 192kHz. If you use an analysis window of $2^{18}$ that gives about 1.4 s of data at a frequency resolution of about 0.73Hz. You won't be able to make EXACTLY 1000Hz but FFT bin 1365 is at 999.76Hz which is probably close enough.

By working in FFT bins instead of absolute frequencies you eliminate the need for the window and you turn this into nice and simple integer problem. 990 Hz becomes bin 1352 and 1010Hz becomes bin 1379 end so your first intermod products will show up at bin 2731 and 27. Provided the amount of non-linear distortion is reasonably small you can get magnitude and phase of the fundamental, the harmonics and the intermod products directly from the FFT coefficient at that bin.

$\endgroup$
2
  • $\begingroup$ Yes, for fundamental tones you can choose frequencies that divide the sampling frequency. But intermodulation products will never be (they are not multiple like harmonics), thus creating spectral leakage. A window function is mandatory in these cases to identify them. 950 Hz = 3 * 990 - 2 * 1010 $\endgroup$
    – Pino
    Commented Sep 4 at 20:54
  • $\begingroup$ yep, I get this wand will delete part of my answer The rest still stands though, intermod products should show up at integer bins $\endgroup$
    – Hilmar
    Commented Sep 4 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.