GetIndexOfMaxValue() public static méthode

public static GetIndexOfMaxValue ( float data ) : int
data float
Résultat int
Exemple #1
0
        public static List <FFTBinInfo> GetLowerMaxBins(float[] magnitudes, int fromIndex, int toIndex, float binFrequencyWidth, float magThresholdRatio)
        {
            List <FFTBinInfo> maxBins = new List <FFTBinInfo>();
            FFTBinInfo        binInfo;
            int   maxIndex;
            float magThreshold;

            fromIndex++;
            toIndex--;

            maxIndex = GATMaths.GetIndexOfMaxValue(magnitudes, fromIndex, toIndex);

            binInfo = new FFTBinInfo(magnitudes, maxIndex, binFrequencyWidth);

            maxBins.Add(binInfo);

            magThreshold = binInfo.InterpolatedMagnitude * magThresholdRatio;

            while (true)
            {
                toIndex = binInfo.BinIndex - 1;

                if (toIndex - fromIndex < 3)
                {
                    break;
                }

                maxIndex = GATMaths.GetIndexOfMaxValue(magnitudes, fromIndex, toIndex);
                binInfo  = new FFTBinInfo(magnitudes, maxIndex, binFrequencyWidth);

                if (binInfo.InterpolatedMagnitude < magThreshold)
                {
                    break;
                }

                maxBins.Add(binInfo);
            }

            return(maxBins);
        }