Phase measurement with FFT for DMM Keithley 7510

I am currenly working on a measurement driver for the DMM Keithley 7510. I implemented a harmonics measurement using FFT (from MathNet library).

First I simply sample my input voltage signal and apply the FFT. From the complex values I get the amplitudes and the phases of the harmonics. The phase results are the phases relative to the fundamental.

I verified my implementations for the amplitude and phase measurement functions by feeding the functions with an "ideal" signal - a sine signal with harmonics generated in MATLAB.

The amplitude measurement works perfectly fine, but I have huge problems with the phase.

• Firstly, with higher frequencies, the deviation of the phase increases. This is due to the input characteristics of the DMM, which is not the main problem. I did my measurements mainy at 50Hz.

• Secondly, the phase depends on the number of samples. I did not analyze this too much, because I have a fixed sample rate for my measurement driver.

• Now the main problem: there seems to be a correlation between the phase and the amplitudes of the harmonics (including the fundamental). This means that by changing the amplitude of a harmonic, the phase results change for all the harmonics. For instance an increase does not necessarily mean an increase in phase: for some harmonics, the phase increases while for others it decreases. I could not find any reasonable explanation for this behaviour.

I tried many different ways to solve the phase problem:

• Windowing: I thought, that it might somehow help. Unfortunately, I found pretty much no sources on the effect of windows on the phase measurement.

• Power of 2 for FFT: I have a power of 2 number of samples on which I apply the FFT.

• DFT: I also tried to apply DFT and calculate the complex value at exactly the frequecies where I wanted. There is as good as no difference between FFT results and DFT results.

• Amplitude interpolation: I found a paper where I found I formula for the amplitude interpolation. By finding the peak amplitude in the frequency domain, I calculated the corresponding phase, but no success. Here I later found, that at the peak amplitude of a harmonic in the frequency domain, the corresponding phase is not the expected/ideal phase. This is also something, that I could not understand ...

My question now is whether I forgot any other things I should check for. Are there any parameters that I should be careful about when computing the phase?

Any suggestions what I could do next?

• to be honest, unless you have a good reason to measure phase, it doesn't matter. perhaps you could explain why you are interested in it. If your tones are not exactly on bin centers the phasor will rotate relative to the last DFT. Harmonics are typically generated by passing tones through a nonlinearity.
– user28715
Jun 25 '19 at 16:21

First off, you should realize that the FFT is just an efficient implementation of the DFT. Power of two sizes are the easiest for it, but modern implementations have slick tricks to do other sizes. Leave that up to the library. The results will be the same.

If your peaks are sufficiently well spaced (two or three bins apart) the following article will show you how to efficiently calculate the phase and amplitude when a peak falls between bins.

For a single pure tone, the results are exact providing you know the exact frequency. You can find several other articles of mine that will show you how to get a very good frequency estimate, exact in the single noiseless pure tone case.

You will have to read the referenced articles (also mine) to understand how it really works.

Ced

If your signal is a repeating waveform, the best approach is to define your frame on a whole multiple of cycles. When you do this, each harmonic will fall in its own bin and there will be spacing (depending on the waveform count) from the nearest bins. When a signal is not a whole number of cycles, that's when the peak falls inbetween the bins and the values get distributed in the nearby bins. This is called leakage and it causes interference. The equations I referenced do a pretty good job of ignoring this interference, but to get as good of a reading as you would by framing a whole number of cycles, you need to remove the effects of nearby estimates (subtract them out of the DFT using my bin value formulas) before measuring a peak.

Also, you should be aware that if you are measuring something like a piano, not all the overtones are harmonic. This prevents you from centering all the bins simulaneously. See: