# New frequency estimator from two DFT bins

Started by February 6, 2017
```Hi Group

I have derived this estimator. The limited tests I have done shows
high accuracy.

Let k be the index of the DFT bin with the largest magnitude.
Let j be the index of the DFT bin with the largest magnitude
neigboring bin k.
That is j=k-1 or j=k+1.

Now let P=Tan(PI*k/N) and Q=Tan(PI*j/N)

Then the normalized frequency is estimated by:

Freq=(N/PI)*Arctan(Sqr(P*Q*(Im[k]*P-Im[j]*Q)/(Im[k]*Q-Im[j]*P)))

where Sqr is Square root and Im[] is the imaginary part of X[].

I was wondering if anyone has a test suite, so it would be possible to
compare with other estimators?

Regards,
Michael Plet
```
```>Hi Group
>
>I have derived this estimator. The limited tests I have done shows
>high accuracy.
>
>
>Let k be the index of the DFT bin with the largest magnitude.
>Let j be the index of the DFT bin with the largest magnitude
>neigboring bin k.
>That is j=k-1 or j=k+1.
>
>Now let P=Tan(PI*k/N) and Q=Tan(PI*j/N)
>
>Then the normalized frequency is estimated by:
>
>Freq=(N/PI)*Arctan(Sqr(P*Q*(Im[k]*P-Im[j]*Q)/(Im[k]*Q-Im[j]*P)))
>
>where Sqr is Square root and Im[] is the imaginary part of X[].
>
>
>I was wondering if anyone has a test suite, so it would be possible to
>compare with other estimators?
>
>
>Regards,
>Michael Plet

To answer your question directly.  You can find a set of SciLab (Matlab
equivalent) routines by Julien Arzi here:

http://www.tsdconseil.fr/log/scriptscilab/festim/index-en.html

Here is the paper he wrote comparing several estimators with varying
levels of noise:

http://www.tsdconseil.fr/log/scriptscilab/festim/freqestim-comp.pdf

I'm pretty sure all the FFT based frequency estimators are three bin
equations.

Here is a paper covering *exact* frequency equations using two bins:

www.vicanek.de/articles/FreqFromTwoBins.pdf

I, too, have an *exact* equation for the two bin case, but in my testing
it did not fare as well as Martin's in the presence of noise so I have not
published it.  It is an overdetermined problem so multiple, different,
exact solutions are possible.

You can find the derivation for my exact three bin formula here:

https://www.dsprelated.com/showarticle/773.php

My blog articles leading up to this one cover the material the derivation
is based on.

When I have a little time, I will plug your equation into one of my test
programs and see how it does.

If you want me to send you some source code, send me an email to cedron at
exede dot net.

Ced
---------------------------------------
Posted through http://www.DSPRelated.com
```
```On Mon, 06 Feb 2017 17:26:52 -0600, "Cedron" <103185@DSPRelated>
wrote:

>>Hi Group
>>
>>I have derived this estimator. The limited tests I have done shows
>>high accuracy.
>>
>>
>>Let k be the index of the DFT bin with the largest magnitude.
>>Let j be the index of the DFT bin with the largest magnitude
>>neigboring bin k.
>>That is j=k-1 or j=k+1.
>>
>>Now let P=Tan(PI*k/N) and Q=Tan(PI*j/N)
>>
>>Then the normalized frequency is estimated by:
>>
>>Freq=(N/PI)*Arctan(Sqr(P*Q*(Im[k]*P-Im[j]*Q)/(Im[k]*Q-Im[j]*P)))
>>
>>where Sqr is Square root and Im[] is the imaginary part of X[].
>>
>>
>>I was wondering if anyone has a test suite, so it would be possible to
>>compare with other estimators?
>>
>>
>>Regards,
>>Michael Plet
>
>To answer your question directly.  You can find a set of SciLab (Matlab
>equivalent) routines by Julien Arzi here:
>
>http://www.tsdconseil.fr/log/scriptscilab/festim/index-en.html
>
>Here is the paper he wrote comparing several estimators with varying
>levels of noise:
>
>http://www.tsdconseil.fr/log/scriptscilab/festim/freqestim-comp.pdf
>
>I'm pretty sure all the FFT based frequency estimators are three bin
>equations.
>
>
>Here is a paper covering *exact* frequency equations using two bins:
>
>www.vicanek.de/articles/FreqFromTwoBins.pdf
>
>I, too, have an *exact* equation for the two bin case, but in my testing
>it did not fare as well as Martin's in the presence of noise so I have not
>published it.  It is an overdetermined problem so multiple, different,
>exact solutions are possible.
>
>You can find the derivation for my exact three bin formula here:
>
>https://www.dsprelated.com/showarticle/773.php
>
>My blog articles leading up to this one cover the material the derivation
>is based on.
>
>When I have a little time, I will plug your equation into one of my test
>programs and see how it does.
>
>If you want me to send you some source code, send me an email to cedron at
>exede dot net.
>
>Ced
>---------------------------------------
>Posted through http://www.DSPRelated.com

Cedron, I have read your articles (771,773 and 787) on dsprelated.
They are very well written and informative! The math is easy to
follow.
I have tons of DSP books, but none of them has stuff like this.

It would be a great help if you can find time to try my formula in
your test program.

Michael
```
```>
>Cedron, I have read your articles (771,773 and 787) on dsprelated.
>They are very well written and informative! The math is easy to
>follow.
>I have tons of DSP books, but none of them has stuff like this.
>
>It would be a great help if you can find time to try my formula in
>your test program.
>
>Michael

Hi Michael,

Your formula performed better than I expected, I'm impressed.  It appears
to be exact in the noiseless case.  Since your formula includes N, it is
definitely a possibility.  Any estimator that does not include N cannot be
exact.  Also, by inspection, your formula will give the correct answer for
an integer value frequency.

However, since you are only using the imaginary parts of the bins, your
formula's susceptibility to noise is going to be very phase shift
dependent.  I ran the same test program with some different phase values
and ended up with some worse results and even a few nans (Not a Number).

When I coded your formula I always used the k = j+1 case.  This should be
correct by symmetry in the formula.  They are still the two largest bins.

As you can also see from the results, my two bin formula is also
susceptible to certain frequency fraction/phase combinations.

Thank you for the kind words.

Ced

=============================================

MP = Michael Plet
CD = Cedron Dawg
MV = Martin Vicanek

The first column under each header is the average error (x100) and the
second column is the standard deviation (x100).

Here is one set of results:

The sample count is 100
and the run size is 100
The phase value is  0.785398

Errors are shown at 100x actual value

Target Noise Level = 0.000

Freq MP2Bin        CD2Bin        MV2BinComb
---- ------------- ------------- -------------
3.0  -0.000  0.000 -0.000  0.000 -0.000  0.000
3.1  -0.000  0.000  0.000  0.000 -0.000  0.000
3.2   0.000  0.000  0.000  0.000  0.000  0.000
3.3   0.000  0.000 -0.000  0.000 -0.000  0.000
3.4   0.000  0.000 -0.000  0.000  0.000  0.000
3.5   0.000  0.000 -0.000  0.000 -0.000  0.000
3.6  -0.000  0.000  0.000  0.000  0.000  0.000
3.7  -0.000  0.000  0.000  0.000  0.000  0.000
3.8   0.000  0.000 -0.000  0.000  0.000  0.000
3.9   0.000  0.000  0.000  0.000 -0.000  0.000

Target Noise Level = 0.001

Freq MP2Bin        CD2Bin        MV2BinComb
---- ------------- ------------- -------------
3.0  -0.002  0.019 -0.000  0.020 -0.001  0.014
3.1  -0.000  0.012  0.005  0.023  0.001  0.012
3.2  -0.002  0.009 -0.004  0.032 -0.002  0.009
3.3  -0.000  0.009 -0.021  0.138  0.000  0.009
3.4   0.000  0.009  0.001  0.037  0.001  0.008
3.5  -0.002  0.011 -0.001  0.015 -0.002  0.008
3.6  -0.004  0.019 -0.001  0.010 -0.002  0.007
3.7   0.011  0.067 -0.000  0.009  0.000  0.008
3.8  -0.006  0.072  0.001  0.011  0.001  0.011
3.9  -0.002  0.031  0.001  0.010  0.000  0.010

Target Noise Level = 0.010

Freq MP2Bin        CD2Bin        MV2BinComb
---- ------------- ------------- -------------
3.0   0.000  0.169  0.018  0.210  0.011  0.154
3.1  -0.013  0.121  0.011  0.173 -0.006  0.106
3.2   0.001  0.105 -0.019  0.283 -0.001  0.107
3.3  -0.000  0.078  0.075  1.523 -0.001  0.077
3.4   0.002  0.089  0.010  0.311  0.003  0.082
3.5  -0.017  0.101 -0.017  0.164 -0.017  0.072
3.6  -0.014  0.171  0.010  0.098  0.002  0.082
3.7  -0.006  0.619 -0.006  0.083 -0.006  0.081
3.8   0.082  0.709 -0.006  0.092 -0.007  0.091
3.9  -0.016  0.317 -0.006  0.106 -0.008  0.110

Target Noise Level = 0.100

Freq MP2Bin        CD2Bin        MV2BinComb
---- ------------- ------------- -------------
3.0   0.229  1.571  0.476  1.835  0.389  1.394
3.1   0.294  1.223  0.116  2.066  0.248  1.146
3.2   0.010  0.929 -0.519  3.283 -0.028  0.966
3.3   0.003  0.841 -6.080 37.449  0.003  0.818
3.4   0.078  0.773 -0.059  3.317  0.066  0.791
3.5  -0.021  1.090  0.148  1.581  0.049  0.836
3.6   0.027  1.765  0.026  0.965  0.027  0.699
3.7   0.902  5.282 -0.038  0.815  0.009  0.802
3.8   0.164  6.399 -0.017  0.907 -0.012  0.906
3.9  -0.686  2.638 -0.097  0.902 -0.178  0.906

Here's how I coded it:

double theP = tan( argBaseBinNumber * M_PI / (double) myN );
double theQ = tan( ( argBaseBinNumber + 1 ) * M_PI / (double) myN
);

double theNum = theP * argBaseOfBinValues[0].myImag
- theQ * argBaseOfBinValues[1].myImag;

double theDen = theQ * argBaseOfBinValues[0].myImag
- theP * argBaseOfBinValues[1].myImag;

double theTemp = sqrt( theP * theQ * theNum / theDen );

double theFrequency = ( (double) myN / M_PI ) * atan( theTemp );

---------------------------------------
Posted through http://www.DSPRelated.com
```
```On Tue, 07 Feb 2017 10:09:03 -0600, "Cedron" <103185@DSPRelated>
wrote:

>>
>>Cedron, I have read your articles (771,773 and 787) on dsprelated.
>>They are very well written and informative! The math is easy to
>>follow.
>>I have tons of DSP books, but none of them has stuff like this.
>>
>>It would be a great help if you can find time to try my formula in
>>your test program.
>>
>>Michael
>
>Hi Michael,
>
>Your formula performed better than I expected, I'm impressed.  It appears
>to be exact in the noiseless case.  Since your formula includes N, it is
>definitely a possibility.  Any estimator that does not include N cannot be
>exact.  Also, by inspection, your formula will give the correct answer for
>an integer value frequency.
>
>However, since you are only using the imaginary parts of the bins, your
>formula's susceptibility to noise is going to be very phase shift
>dependent.  I ran the same test program with some different phase values
>and ended up with some worse results and even a few nans (Not a Number).
>
>When I coded your formula I always used the k = j+1 case.  This should be
>correct by symmetry in the formula.  They are still the two largest bins.
>
>As you can also see from the results, my two bin formula is also
>susceptible to certain frequency fraction/phase combinations.
>
>Thank you for the kind words.
>
>Ced
>
>=============================================
>
>MP = Michael Plet
>CD = Cedron Dawg
>MV = Martin Vicanek
>
>The first column under each header is the average error (x100) and the
>second column is the standard deviation (x100).
>
>Here is one set of results:
>
>The sample count is 100
>and the run size is 100
> The phase value is  0.785398
>
>Errors are shown at 100x actual value
>
>Target Noise Level = 0.000
>
>Freq MP2Bin        CD2Bin        MV2BinComb
>---- ------------- ------------- -------------
>3.0  -0.000  0.000 -0.000  0.000 -0.000  0.000
>3.1  -0.000  0.000  0.000  0.000 -0.000  0.000
>3.2   0.000  0.000  0.000  0.000  0.000  0.000
>3.3   0.000  0.000 -0.000  0.000 -0.000  0.000
>3.4   0.000  0.000 -0.000  0.000  0.000  0.000
>3.5   0.000  0.000 -0.000  0.000 -0.000  0.000
>3.6  -0.000  0.000  0.000  0.000  0.000  0.000
>3.7  -0.000  0.000  0.000  0.000  0.000  0.000
>3.8   0.000  0.000 -0.000  0.000  0.000  0.000
>3.9   0.000  0.000  0.000  0.000 -0.000  0.000
>
>
>Target Noise Level = 0.001
>
>Freq MP2Bin        CD2Bin        MV2BinComb
>---- ------------- ------------- -------------
>3.0  -0.002  0.019 -0.000  0.020 -0.001  0.014
>3.1  -0.000  0.012  0.005  0.023  0.001  0.012
>3.2  -0.002  0.009 -0.004  0.032 -0.002  0.009
>3.3  -0.000  0.009 -0.021  0.138  0.000  0.009
>3.4   0.000  0.009  0.001  0.037  0.001  0.008
>3.5  -0.002  0.011 -0.001  0.015 -0.002  0.008
>3.6  -0.004  0.019 -0.001  0.010 -0.002  0.007
>3.7   0.011  0.067 -0.000  0.009  0.000  0.008
>3.8  -0.006  0.072  0.001  0.011  0.001  0.011
>3.9  -0.002  0.031  0.001  0.010  0.000  0.010
>
>
>Target Noise Level = 0.010
>
>Freq MP2Bin        CD2Bin        MV2BinComb
>---- ------------- ------------- -------------
>3.0   0.000  0.169  0.018  0.210  0.011  0.154
>3.1  -0.013  0.121  0.011  0.173 -0.006  0.106
>3.2   0.001  0.105 -0.019  0.283 -0.001  0.107
>3.3  -0.000  0.078  0.075  1.523 -0.001  0.077
>3.4   0.002  0.089  0.010  0.311  0.003  0.082
>3.5  -0.017  0.101 -0.017  0.164 -0.017  0.072
>3.6  -0.014  0.171  0.010  0.098  0.002  0.082
>3.7  -0.006  0.619 -0.006  0.083 -0.006  0.081
>3.8   0.082  0.709 -0.006  0.092 -0.007  0.091
>3.9  -0.016  0.317 -0.006  0.106 -0.008  0.110
>
>
>Target Noise Level = 0.100
>
>Freq MP2Bin        CD2Bin        MV2BinComb
>---- ------------- ------------- -------------
>3.0   0.229  1.571  0.476  1.835  0.389  1.394
>3.1   0.294  1.223  0.116  2.066  0.248  1.146
>3.2   0.010  0.929 -0.519  3.283 -0.028  0.966
>3.3   0.003  0.841 -6.080 37.449  0.003  0.818
>3.4   0.078  0.773 -0.059  3.317  0.066  0.791
>3.5  -0.021  1.090  0.148  1.581  0.049  0.836
>3.6   0.027  1.765  0.026  0.965  0.027  0.699
>3.7   0.902  5.282 -0.038  0.815  0.009  0.802
>3.8   0.164  6.399 -0.017  0.907 -0.012  0.906
>3.9  -0.686  2.638 -0.097  0.902 -0.178  0.906
>
>
>Here's how I coded it:
>
>
>        double theP = tan( argBaseBinNumber * M_PI / (double) myN );
>        double theQ = tan( ( argBaseBinNumber + 1 ) * M_PI / (double) myN
>);
>
>        double theNum = theP * argBaseOfBinValues[0].myImag
>                      - theQ * argBaseOfBinValues[1].myImag;
>
>        double theDen = theQ * argBaseOfBinValues[0].myImag
>                      - theP * argBaseOfBinValues[1].myImag;
>
>        double theTemp = sqrt( theP * theQ * theNum / theDen );
>
>        double theFrequency = ( (double) myN / M_PI ) * atan( theTemp );
>
>
>---------------------------------------
>Posted through http://www.DSPRelated.com

Hi Cedron, thank you so much for taking the time to test my formula!

I'm not surprised that it is exact in the noiseless case because of
the way I derived it.
But I had no idea what would happen when noise was added.
It seems that all three formulas are quite good (so don't be shy about
publishing yours :-))

Sure k=j+1 is fine. Then k can be the largest magnitude and j the
largest neighbor or j the largest magnitude and k the largest
neighbor.

I am working on another formula to use the real part. After that I
will see if I can use both real and imaginary parts in one formula.
I think a formula based on two complex values will be more robust.

Thanks again for testing my formula against some others.

Michael
```
```On Mon, 06 Feb 2017 19:17:27 +0100, Michael Plet <me@home.com> wrote:

>Hi Group
>
>I have derived this estimator. The limited tests I have done shows
>high accuracy.
>
>
>Let k be the index of the DFT bin with the largest magnitude.
>Let j be the index of the DFT bin with the largest magnitude
>neigboring bin k.
>That is j=k-1 or j=k+1.
>
>Now let P=Tan(PI*k/N) and Q=Tan(PI*j/N)
>
>Then the normalized frequency is estimated by:
>
>Freq=(N/PI)*Arctan(Sqr(P*Q*(Im[k]*P-Im[j]*Q)/(Im[k]*Q-Im[j]*P)))
>
>where Sqr is Square root and Im[] is the imaginary part of X[].
>
>
>I was wondering if anyone has a test suite, so it would be possible to
>compare with other estimators?
>
>
>Regards,
>Michael Plet

The link below is very old, but has some example estimators as well as
some test code to run them.   It would not be difficult to add your
estimator and test it in the context of the other included estimators.

http://www.ericjacobsen.org/fe2/fe2.htm

Your estimator is quite complex on the face of it, and usually
two-term estimators have difficulty at some point as the frequency
offset varies, i.e., performance is highly offset dependent.  Just
something to look out for.

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

```
```On Tue, 07 Feb 2017 21:29:48 GMT, eric.jacobsen@ieee.org wrote:

>On Mon, 06 Feb 2017 19:17:27 +0100, Michael Plet <me@home.com> wrote:
>
>>Hi Group
>>
>>I have derived this estimator. The limited tests I have done shows
>>high accuracy.
>>
>>
>>Let k be the index of the DFT bin with the largest magnitude.
>>Let j be the index of the DFT bin with the largest magnitude
>>neigboring bin k.
>>That is j=k-1 or j=k+1.
>>
>>Now let P=Tan(PI*k/N) and Q=Tan(PI*j/N)
>>
>>Then the normalized frequency is estimated by:
>>
>>Freq=(N/PI)*Arctan(Sqr(P*Q*(Im[k]*P-Im[j]*Q)/(Im[k]*Q-Im[j]*P)))
>>
>>where Sqr is Square root and Im[] is the imaginary part of X[].
>>
>>
>>I was wondering if anyone has a test suite, so it would be possible to
>>compare with other estimators?
>>
>>
>>Regards,
>>Michael Plet
>
>The link below is very old, but has some example estimators as well as
>some test code to run them.   It would not be difficult to add your
>estimator and test it in the context of the other included estimators.
>
>http://www.ericjacobsen.org/fe2/fe2.htm
>
>Your estimator is quite complex on the face of it, and usually
>two-term estimators have difficulty at some point as the frequency
>offset varies, i.e., performance is highly offset dependent.  Just
>something to look out for.
>
>
>
>---
>This email has been checked for viruses by Avast antivirus software.
>https://www.avast.com/antivirus

Thank you very much for the link. I'll have a look at the other
estimators and the code.

```
```>
>The link below is very old, but has some example estimators as well as
>some test code to run them.   It would not be difficult to add your
>estimator and test it in the context of the other included estimators.
>
>http://www.ericjacobsen.org/fe2/fe2.htm
>
>Your estimator is quite complex on the face of it, and usually
>two-term estimators have difficulty at some point as the frequency
>offset varies, i.e., performance is highly offset dependent.  Just
>something to look out for.
>
>
>
>---
>This email has been checked for viruses by Avast antivirus software.
>https://www.avast.com/antivirus

Jacobsen's estimator is actually an approximation of my 3 bin formula.
I've got a blog article in rough draft form that describes the differences
and the conditions under which they matter.  The rest of the estimators on
the page you referenced are also approximations.

The difference between having exact equations and approximations can be
seen in the noiseless case.  If I were to reduce the sample count, the
differences would be even more pronounced.  Although the exact formulas
tend to be a little more computationally intensive, the extra work is
swamped by the amount of calculations required for the DFT values so
overall the extra computations are insignificant.

I am looking forward to seeing the improved version of Michael Plet's
formula which should also employs the real parts of the DFT bins.  Just
like Vicanek's 2 bin formula, I'll bet it won't suffer any frequency
offset variations that you speak of.  His current one, and my 2 bin one,
certainly do in the presence of noise.

Ced

==========================================================================

The sample count is 100
and the run size is 100
The phase value is  0.785398

Errors are shown at 100x actual value

Target Noise Level = 0.000

Freq MP2Bin        CD3Bin        Jacobsen3Bin
---- ------------- ------------- -------------
3.0  -0.000  0.000  0.000  0.000  0.000  0.000
3.1  -0.000  0.000 -0.000  0.000 -0.169  0.000
3.2   0.000  0.000  0.000  0.000 -0.515  0.000
3.3   0.000  0.000  0.000  0.000 -0.720  0.000
3.4   0.000  0.000 -0.000  0.000 -0.543  0.000
3.5   0.000  0.000  0.000  0.000 -0.014  0.000
3.6  -0.000  0.000 -0.000  0.000 -0.325  0.000
3.7  -0.000  0.000  0.000  0.000 -0.428  0.000
3.8   0.000  0.000  0.000  0.000 -0.297  0.000
3.9   0.000  0.000  0.000  0.000 -0.092  0.000

Target Noise Level = 0.001

Freq MP2Bin        CD3Bin        Jacobsen3Bin
---- ------------- ------------- -------------
3.0   0.000  0.017  0.000  0.011  0.000  0.011
3.1  -0.001  0.011 -0.001  0.010 -0.169  0.011
3.2  -0.000  0.009  0.001  0.009 -0.515  0.010
3.3   0.000  0.009  0.001  0.011 -0.719  0.012
3.4  -0.000  0.009 -0.001  0.011 -0.544  0.013
3.5  -0.002  0.012 -0.003  0.014 -0.017  0.016
3.6  -0.001  0.018 -0.001  0.014 -0.326  0.012
3.7  -0.006  0.060 -0.002  0.015 -0.429  0.013
3.8   0.001  0.069  0.001  0.011 -0.296  0.010
3.9  -0.001  0.032 -0.002  0.010 -0.094  0.010

Target Noise Level = 0.010

Freq MP2Bin        CD3Bin        Jacobsen3Bin
---- ------------- ------------- -------------
3.0   0.019  0.154  0.003  0.094  0.002  0.092
3.1   0.001  0.125 -0.003  0.093 -0.173  0.094
3.2  -0.012  0.088  0.007  0.102 -0.503  0.110
3.3   0.005  0.081  0.004  0.103 -0.716  0.115
3.4  -0.002  0.084 -0.002  0.120 -0.542  0.139
3.5  -0.009  0.114  0.003  0.152 -0.009  0.179
3.6   0.006  0.168  0.033  0.138 -0.296  0.120
3.7   0.091  0.596  0.005  0.119 -0.423  0.108
3.8   0.140  0.690 -0.023  0.132 -0.316  0.121
3.9   0.035  0.285  0.018  0.107 -0.074  0.104

Target Noise Level = 0.100

Freq MP2Bin        CD3Bin        Jacobsen3Bin
---- ------------- ------------- -------------
3.0  -0.176  1.766  0.035  1.132  0.053  1.111
3.1   0.238  1.089  0.173  1.014 -0.018  1.063
3.2  -0.081  0.968 -0.203  1.009 -0.737  1.073
3.3   0.077  0.824  0.053  1.094 -0.665  1.211
3.4  -0.042  0.856 -0.024  1.197 -0.551  1.381
3.5  -0.014  1.168 -0.043  1.355 -0.069  1.565
3.6   0.110  1.797 -0.150  1.594 -0.448  1.418
3.7   0.246  5.629  0.003  1.177 -0.445  1.087
3.8   1.384  8.476 -0.044  1.083 -0.348  1.020
3.9  -0.113  3.245 -0.040  0.985 -0.137  0.948

---------------------------------------
Posted through http://www.DSPRelated.com
```
```>Hi Group
>
>I have derived this estimator. The limited tests I have done shows
>high accuracy.
>
>
>Let k be the index of the DFT bin with the largest magnitude.
>Let j be the index of the DFT bin with the largest magnitude
>neigboring bin k.
>That is j=k-1 or j=k+1.
>
>Now let P=Tan(PI*k/N) and Q=Tan(PI*j/N)
>
>Then the normalized frequency is estimated by:
>
>Freq=(N/PI)*Arctan(Sqr(P*Q*(Im[k]*P-Im[j]*Q)/(Im[k]*Q-Im[j]*P)))
>
>where Sqr is Square root and Im[] is the imaginary part of X[].
>
>
>I was wondering if anyone has a test suite, so it would be possible to
>compare with other estimators?
>
>
>Regards,
>Michael Plet

Hi Michael,

your estimator seems to be equivalent to mine
(http://vicanek.de/articles/FreqFromTwoBins.pdf) if you choose a = b = 1.
I have uploaded an extended version of my writeup to facilitate
translation between my centered DFT notation and the standard DFT. Perhaps
you can get some inspiration from there for a formula based on Re[k] (and
some combination of formulas to optimize SNR)?

Best
Martin
---------------------------------------
Posted through http://www.DSPRelated.com
```
```On Tue, 07 Feb 2017 22:55:37 -0600, "martinvicanek" <99986@DSPRelated>
wrote:

>>Hi Group
>>
>>I have derived this estimator. The limited tests I have done shows
>>high accuracy.
>>
>>
>>Let k be the index of the DFT bin with the largest magnitude.
>>Let j be the index of the DFT bin with the largest magnitude
>>neigboring bin k.
>>That is j=k-1 or j=k+1.
>>
>>Now let P=Tan(PI*k/N) and Q=Tan(PI*j/N)
>>
>>Then the normalized frequency is estimated by:
>>
>>Freq=(N/PI)*Arctan(Sqr(P*Q*(Im[k]*P-Im[j]*Q)/(Im[k]*Q-Im[j]*P)))
>>
>>where Sqr is Square root and Im[] is the imaginary part of X[].
>>
>>
>>I was wondering if anyone has a test suite, so it would be possible to
>>compare with other estimators?
>>
>>
>>Regards,
>>Michael Plet
>
>Hi Michael,
>
>your estimator seems to be equivalent to mine
>(http://vicanek.de/articles/FreqFromTwoBins.pdf) if you choose a = b = 1.
>I have uploaded an extended version of my writeup to facilitate
>translation between my centered DFT notation and the standard DFT. Perhaps
>you can get some inspiration from there for a formula based on Re[k] (and
>some combination of formulas to optimize SNR)?
>
>Best
>Martin
>---------------------------------------
>Posted through http://www.DSPRelated.com

Hi Martin

If a = b = 1, wouldn't my formula include Re[k]?

I have tried to insert some of my test bin values into your formula.
The result was not what I expected. I think I need to rotate the DFT
bins before applying your formula. I will look into that.

Thank you for the link to the updated document.
I am sure I will find inspiration in that.

This subject is so basic and pure that I don't understand why it
hasn't been treated in DSP litterature.

Michael
```