This project has moved. For the latest updates, please go here.

Possibility of a bug in the "GetYPosLog" function of the Spectrum Analyser Demo

Oct 11, 2014 at 10:35 PM
First, I would to thank you Mark of this library.
It is really good and very helpful. :-)

Secondly, while looking at your Spectrum Analyser I saw the following thing:
private double GetYPosLog(Complex c)
        {
            // not entirely sure whether the multiplier should be 10 or 20 in this case.
            // going with 10 from here http://stackoverflow.com/a/10636698/7532
            double intensityDB = 10 * Math.Log10(Math.Sqrt(c.X * c.X + c.Y * c.Y));
            double minDB = -90;
            if (intensityDB < minDB) intensityDB = minDB;
            double percent = intensityDB / minDB;
            // we want 0dB to be at the top (i.e. yPos = 0)
            double yPos = percent * this.ActualHeight;
            return yPos;
        }
The definition of DB is DB = 20*log_10(number), so the the variable "intesityDB" should
be:
double intensityDB = 20 * Math.Log10(Math.Sqrt(c.X * c.X + c.Y * c.Y));
or:
double intensityDB = 10 * Math.Log10(c.X * c.X + c.Y * c.Y);