0
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Stanley Pawlukiewicz Jun 25 at 16:21
0
$\begingroup$

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:

https://www.dsprelated.com/thread/7902/the-spectral-complexity-of-a-single-musical-note

The easiest way to really understand a DFT is to realize that each bin index (zero based, not MATLAB one based) corresponds to a tone which has the same number of cycles per frame as the the index number. Thus if you frame five cycles of your periodic signal, ideally, you expect values in bins 0, 5, 10, 15, etc. and all the inbetween bins will be zero. This is independent of the sample count within the frame. What a higher sample count buys you is more bins at higher frequencies,i,e, you are moving the Nyquist limit up.

$\endgroup$
  • $\begingroup$ Thank you very much for the links. I will look into it. The thing is, that I have already tried frequency estimations and finding the peak frequency also works, but my main problem is that the phase somehow depends on the amplitudes of the harmonics. Moreover, as I have already mention, the correct/expected phase is not located at the peak frequency. I cannot understand how the phase is affected by the amplitudes of the harmonics ... $\endgroup$ – Aziz Jun 25 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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