protected LinkedList<double> extract_freq(ILNumerics.ILRetArray<ILNumerics.complex> o) { if (o.Length > 0) { double x = average(o); LinkedList<double> res = new LinkedList<double>(); foreach (ILNumerics.complex a in o) { double n = Math.Round(Math.Sqrt(a.real * a.real + a.imag * a.imag) * 128 / o.Length, 2); if (!double.IsInfinity(n)) res.AddLast(Math.Round(Math.Sqrt(a.real * a.real + a.imag * a.imag) * 128 / o.Length, 2)); else res.AddLast(0); } return res; } return null; }
protected double average(ILNumerics.ILRetArray<ILNumerics.complex> o) { double sum=0, count = 0; foreach (ILNumerics.complex a in o) { count++; sum += a.real; } return sum/count; }