type TSpectrumPeaksAnalyzer = class(TPersistent);
Manages frequency spectrum peaks.
Marks, traces, interpolates and filters peaks of the owning spectrum. Because the spectrum is sampled only at the discrete bin frequencies f_k = k HzRes, the true frequency of a peak that falls between two bins is estimated by Interpolation.Method. For an off-bin tone of true frequency f_0 the nearest bin gives an error up to 1/2HzRes, while the interpolators reduce it: imNumeric / imQuinnSecond reach | f - f_0| lesssim 10^(-3) HzRes (rectangular window, no zero padding), and imQuadratic / imBarycentric / imJain a few 10^(-1) HzRes. imNumeric also returns the complex spectral value, so amplitude and phase are recovered as well. The phase reported by the numeric estimator is the DTFT phase arg X(f) rotated by a fixed quadrature term. TraceMethod controls how peaks are (re)marked: ptLargest marks the LargestCount strongest peaks (sorted by descending amplitude), ptAllPeaks marks every local maximum, and ptAmpltHarmonics / ptFreqHarmonics mark a fundamental and its harmonics. Methods other than imNumeric require a rectangular window with ZeroPadding = 1 and fall back to imNone otherwise.
Properties
| Name | Type | Description |
|---|---|---|
| Active | Boolean | Set this property to false, to disable peak tracing, marking, interpolating and filtering when the Update method is called. |
| BandwidthH | Double | Defines the upper frequency that limits the search for peak. |
| BandwidthL | Double | Defines the lower frequency that limits the search for peak. |
| HarmonicsCount | Integer | Defines the number of harmonics to be marked, if TraceMethod is ptAmpltHarmonics or ptFreqHarmonics. |
| Interpolation | TSpectrumPeakInterpolation | Defines the peak interpolation parameters. |
| Item | TMarkRecord | Default array property for the marks (=peaks) array. |
| LargestCount | Integer | Defines the number of largest peaks to mark, when TraceMethod = ptLargest. |
| LargestRatio | Double | Defines the ratio between the largest peak below which, the peak will not be considered. |
| List | TMarkList | A pointer to a list of all marked peaks (= TSpectrum.Marks). Read only. |
| NormalizedAmplt | TNormalizedAmplt | Parameters for normalized amplitude. |
| NormalizedFreq | TNormalizedFreq | Parameters for normalized frequency. |
| TraceInterval | Double | Defines the interval centered around the current position of peak in percentage of the bandwidth, within which the new position of the peak is to be searched for. |
| TraceMethod | TPeakTraceMethod | Defines the method used to trace and mark the peaks. |
| UseFullBandwidth | Boolean | Set this property to true, to assume that BandwidthL = 0 and BandwidthH equals the Nyquist frequency. |
Methods
| Name | Description |
|---|---|
| AddMark | Returns the index of the newly added mark at Freq. |
| Adjust | Called by Update method, if TraceMethod is ptNone. |
| AmpltHarmonics | Called by the Update method, if TraceMethod is ptAmpltHarmonics. |
| Approximate (3) | Finds the maximum of the peak at Freq and applies interpolation. |
| ApproximateComplexEst (2) | Finds the maximum of the peak at Freq and applies interpolation. |
| Filter | Filters the peak specified with Index. |
| FilterAll | Filters all peaks. |
| FindAllPeaks | Called by Update method, if TraceMethod is ptAll. |
| FindFirstHarmonic | Called by Update method, if TraceMethod is ptFirstHarmonic. |
| FindFrequency (2) | Finds the largest peak on the frequency interval for each value in Frequency parameter. |
| FindFundamentals | Locates the first harmonics of a harmonic series. |
| FindLargestPeaks | Called by Update method, if TraceMethod is ptLargest. |
| FreqHarmonics | Called by the Update method, if TraceMethod is ptFreqHarmonics. |
| LogAmplt | Converts all peaks in dB. The associated spectrum must already be in logarithmic scale. |
| Trace | Called by the Update method, if TraceMethod is ptCurrent. |
| Update | Reestimates the order frequency and traces the peaks. |