private double getFn(DoubleArray Pxx, DoubleArray Fx, double n) { //returns Fn = the frequency below which n percent of total power is present totalPower = Pxx.Sum(); double curSumPower = 0; int i; for (i = 0; i < Pxx.Count(); i++) { curSumPower += Pxx[i]; if (curSumPower / totalPower > n) { break; } } return((i + 1 < Fx.Length) ? Fx[i + 1] : Fx[Fx.Length - 1]); }