DSPRelated.com
Forums

Distortion Measurement, use FFT or not ?

Started by Adam S February 1, 2008
I trying to figure out whats the best method to measure distortion 
products from a single test tone. Distortion will be relatively low and 
good S/N ratio.
	First I tried using FFT, but I run into the trouble of accurately 
extracting amplitudes and frequency information. The test signal is of 
arbitrary frequency and so FFT side lobes make it difficult obtaining 
spectral data.

The other idea I head was to use Goertzel's algorithm to effectively run 
a single DFT on each harmonic including the fundamental. The problem is 
I first need to accurately know the frequency of the fundamental so I 
can then set a centre frequency for each harmonic.

I'd really be interested know how other people do it.

Regards,
Adam
Adam,

    Have you used plain FFT. or FFT with window approach.

    Normally you are supposed to window the data prior to
    computing FFT. Since in your problem you are not interested
    in distinguishing 2 close by frequencies, using windows
    with wider main lobe and better side lobe attn will help.
    my suggestion is use blackman-harris 11 term windowing 
    approach. with 11 term windowing approach you can measure
    snr of the order of 96db (16 bit datapath), if your harmonic
    distortion is in the same range then you will be able to 
    catch it. second thing is if the fin frequency is not exact
    multiple of Fs, then the freq will not fall on one single
    bin. hence you can increase the resolution of instrumentation
    by means of zero padding. don't make it power of 2. just keep
    it such that the freq of interest is closer to any one bin.

    With this you will increase your chances of seeing harmonic
    distortion spikes in the FFT spectrum.

Regards
Bharat Pathak
www.arithos.com

Arithos Designs 
~dsp Simplified.







>I trying to figure out whats the best method to measure distortion >products from a single test tone. Distortion will be relatively low and >good S/N ratio. > First I tried using FFT, but I run into the trouble of accurately >extracting amplitudes and frequency information. The test signal is of >arbitrary frequency and so FFT side lobes make it difficult obtaining >spectral data. > >The other idea I head was to use Goertzel's algorithm to effectively run
>a single DFT on each harmonic including the fundamental. The problem is >I first need to accurately know the frequency of the fundamental so I >can then set a centre frequency for each harmonic. > >I'd really be interested know how other people do it. > >Regards, >Adam >
Adam S wrote:
> I trying to figure out whats the best method to measure distortion > products from a single test tone. Distortion will be relatively low and > good S/N ratio. > First I tried using FFT, but I run into the trouble of accurately > extracting amplitudes and frequency information. The test signal is of > arbitrary frequency and so FFT side lobes make it difficult obtaining > spectral data. > > The other idea I head was to use Goertzel's algorithm to effectively run > a single DFT on each harmonic including the fundamental. The problem is > I first need to accurately know the frequency of the fundamental so I > can then set a centre frequency for each harmonic. > > I'd really be interested know how other people do it.
Does it have to be done digitally? Analog or digital, make a sharp notch filter at the frequency of the test tone (which had netter be clean). Note that a very good high-pass filter that blocks the test frequency f and passes 2f and above will do instead. Measure energy of the entire output signal; that is S + THD. (For small distortion, it's practically the same as S.) Measure the output of the blocking filter; that is THD. Go from there. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Jerry Avins wrote:
> Adam S wrote: >> I trying to figure out whats the best method to measure distortion >> products from a single test tone. Distortion will be relatively low >> and good S/N ratio. >> First I tried using FFT, but I run into the trouble of accurately >> extracting amplitudes and frequency information. The test signal is of >> arbitrary frequency and so FFT side lobes make it difficult obtaining >> spectral data. >> >> The other idea I head was to use Goertzel's algorithm to effectively >> run a single DFT on each harmonic including the fundamental. The >> problem is I first need to accurately know the frequency of the >> fundamental so I can then set a centre frequency for each harmonic. >> >> I'd really be interested know how other people do it. > > Does it have to be done digitally? Analog or digital, make a sharp notch > filter at the frequency of the test tone (which had netter be clean).
>>>better<<<
> Note that a very good high-pass filter that blocks the test frequency f > and passes 2f and above will do instead. Measure energy of the entire > output signal; that is S + THD. (For small distortion, it's practically > the same as S.) Measure the output of the blocking filter; that is THD. > Go from there. > > Jerry
-- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Jerry Avins wrote:
> Adam S wrote: >> I trying to figure out whats the best method to measure distortion >> products from a single test tone. Distortion will be relatively low >> and good S/N ratio. >> First I tried using FFT, but I run into the trouble of accurately >> extracting amplitudes and frequency information. The test signal is of >> arbitrary frequency and so FFT side lobes make it difficult obtaining >> spectral data. >> >> The other idea I head was to use Goertzel's algorithm to effectively >> run a single DFT on each harmonic including the fundamental. The >> problem is I first need to accurately know the frequency of the >> fundamental so I can then set a centre frequency for each harmonic. >> >> I'd really be interested know how other people do it. > > Does it have to be done digitally? Analog or digital, make a sharp notch > filter at the frequency of the test tone (which had better be clean). > Note that a very good high-pass filter that blocks the test frequency f > and passes 2f and above will do instead. Measure energy of the entire > output signal; that is S + THD. (For small distortion, it's practically > the same as S.) Measure the output of the blocking filter; that is THD. > Go from there. > > Jerry
-- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Hi Bharat,

My early efforts with FFT was no windowing but that quickly showed the 
spectral leakage from the fundamental covering enough of the spectrum to 
completely swamp all harmonics. Applying a Hanning windowing improved 
sensitivity immensely.

The only reference I could find on a Google search for a high order 
blackman-harris equations was
http://www.diracdelta.co.uk/science/source/b/l/blackman-harris%20window/source.html

4th term equation has a -92dB side lobe. I assume side lobes diminish 
even more as they get further way from the centre lobe. This probably 
suits my needs.

One question about amplitudes:

If the frequency is in the middle of two bins, then can the true 
amplitude still be calculated accurately ? If so how ?
My belief is that I take the sum of squared magnitudes of several bins 
around the frequency of interest and then square root the result.

Adam



bharat pathak wrote:
> Adam, > > Have you used plain FFT. or FFT with window approach. > > Normally you are supposed to window the data prior to > computing FFT. Since in your problem you are not interested > in distinguishing 2 close by frequencies, using windows > with wider main lobe and better side lobe attn will help. > my suggestion is use blackman-harris 11 term windowing > approach. with 11 term windowing approach you can measure > snr of the order of 96db (16 bit datapath), if your harmonic > distortion is in the same range then you will be able to > catch it. second thing is if the fin frequency is not exact > multiple of Fs, then the freq will not fall on one single > bin. hence you can increase the resolution of instrumentation > by means of zero padding. don't make it power of 2. just keep > it such that the freq of interest is closer to any one bin. > > With this you will increase your chances of seeing harmonic > distortion spikes in the FFT spectrum. > > Regards > Bharat Pathak > www.arithos.com > > Arithos Designs > ~dsp Simplified. > > > > > > > >> I trying to figure out whats the best method to measure distortion >> products from a single test tone. Distortion will be relatively low and >> good S/N ratio. >> First I tried using FFT, but I run into the trouble of accurately >> extracting amplitudes and frequency information. The test signal is of >> arbitrary frequency and so FFT side lobes make it difficult obtaining >> spectral data. >> >> The other idea I head was to use Goertzel's algorithm to effectively run > >> a single DFT on each harmonic including the fundamental. The problem is >> I first need to accurately know the frequency of the fundamental so I >> can then set a centre frequency for each harmonic. >> >> I'd really be interested know how other people do it. >> >> Regards, >> Adam >>
>One question about amplitudes: > >If the frequency is in the middle of two bins, then can the true >amplitude still be calculated accurately ? If so how ?
This can be done using interpolation. Look at any 4 point interpolation formulas like catmull-rom. for example if you computed the ampiltudes of 4 neighbouring points. A-----------B-----------C----------D and the actual freq index lies in-between B and C at a fractional distance of x (x ranges from 0 to 1). A-----------B----O------C----------D <-x--> then amplitude at 0 can be calculated using O = c0(x)*A + c1(x)*B + c2(x)*C + c3(x)*D Even 4 point sinc(x) interpolation coefficients should do. Try with linear interpolation first O = (1-x)*B + x*C so that you get confidence and then extend the concept using sinc(x) 4 point interpolation coefficients. Regards Bharat Pathak Arithos Designs ~dsp Simplified. www.arithos.com
>My belief is that I take the sum of squared magnitudes of several bins >around the frequency of interest and then square root the result. > >Adam
Sorry,

the <--x--> appeared at the wrong place.

x is the fractional distance between point B and output O.

Regards
Bharat Pathak

www.arithos.com

One more point:

since A,B,C and D will be complex data, you need to perform

abs(A), abs(B) abs(C) and abs(D) prior to feeding it to 
interpolation.

Not quite sure though as to how phase will play an important
role in FFT datapoints interpolation? or do you need to 
consider it or ditch it by doing abs operation. 

Rick, Steve, Rune, Robert and many more.... any suggestions??

Regards
Bharat


Hi Bharat

I'm a bit confused as to how interpolation of FFT bin magnitudes can be 
used to pin point the  magnitude of tone laying at a frequency  between 
those bins.
As I understand, when a signal is not exactly a multiple of the sampling 
frequency then the power of that signal is distributed across 
surrounding FFT bins. So if one takes the average power (sum of squares 
of magnitudes) over these bins then they will get almost the same power 
as from a single bin when the input frequency is an exact multiple of 
Fs. I just wrote a small test program to check this for myself.

Experimentally I found that when using a Hanning window the useful side 
bins only extended about +-2 bin either side of the centre bin. The 
spectrum power across these 5 bins showed to add up to about 0.9997 of 
the total power.

I've heard FFT interpolation being used to estimating the frequency of a 
single tone, but not its magnitude.

regards,

Adam

bharat pathak wrote:
>> One question about amplitudes: >> >> If the frequency is in the middle of two bins, then can the true >> amplitude still be calculated accurately ? If so how ? > > This can be done using interpolation. Look at any 4 point > interpolation formulas like catmull-rom. for example if you > computed the ampiltudes of 4 neighbouring points. > > A-----------B-----------C----------D > > and the actual freq index lies in-between B and C at a fractional > distance of x (x ranges from 0 to 1). > > A-----------B----O------C----------D > <-x--> > > then amplitude at 0 can be calculated using > > O = c0(x)*A + c1(x)*B + c2(x)*C + c3(x)*D > > Even 4 point sinc(x) interpolation coefficients should do. > > Try with linear interpolation first > > O = (1-x)*B + x*C > > so that you get confidence and then extend the concept using sinc(x) > 4 point interpolation coefficients.