TSpectrumAnalyzer Class

type TSpectrumAnalyzer = class(TCustomSpectrumAnalyzer);

Computes and analyzes a frequency spectrum.

Estimates the single-sided amplitude and phase spectrum of the signal on the Input property and stores the result in Self.Amplt and Self.Phase. For a real sinusoid of amplitude A that falls exactly on FFT bin k (with a rectangular Window and ZeroPadding = 1, i.e. 0<k<N/20 < k < N/2) the amplitude spectrum reads back the true amplitude, Amplt[k] = A, f_k = k * HzRes, HzRes = F_s/N. The complex DFT X[k]=sum_(n=0)^(N-1) x[n] e^(-j 2pi k n / N) is scaled so that, away from DC and Nyquist, Amplt[k] = (2 | X[k]|)/(N CG), CG = 1/Nsum_(n=0)^(N-1) w[n], where w is the chosen Window and CG its coherent gain, so the recovered amplitude is independent of the window. SpectrumType selects the readout: power =Amplt^2, RMS =sqrt(2)/2 Amplt, peak-peak =2 Amplt. Parseval holds: the mean square of the time signal equals 1/2sum_(k>0)Amplt[k]^2 plus the DC term. Method chooses FFT, an autoregressive estimator (Yule-Walker, Burg, covariance, modified covariance) of order ArOrder, or the chirp-Z transform; the AR estimators recover spectral resonances of an AR process. DCDump removes the mean before the transform; an empty Input yields an empty spectrum. The resulting spectrum is always placed in Self.Amplt (amplitude spectrum) and Self.Phase (phase spectrum).

Properties

NameTypeDescription
ActiveBooleanSet active to false to suppress the propagation of the Pull request and the subsequent call to the Update method.
ActualZeroPaddingDoubleReady only. Returns the ratio between the original signal length and the length of the analyzed signal padded with zeros.
AmpltTVecStores the amplitude of the spectrum.
ArOrderIntegerDefines the order for the autogressive spectral estimators.
AveragesIntegerUsed to store the number of averages made.
BandsTSpectrumBandsAnalyzerHolds the parameters for the frequency bands.
BandWidthDoubleReturns the bandwidth of the spectrum in [Hz].
BandwidthHDoubleReturns the upper bandwidth edge of the signal.
BandwidthLDoubleReturns the lower bandwidth edge of the signal.
BlockAssignBooleanBlock streaming of specific properties when storing only a "template".
ComplexBooleanSet this property to true, to request computation using complex numbers.
ComplexSpectrumTVecAfter the first call to Update method, this property returns a pointer to the scaled complex spectrum.
ConjExtendBooleanIf True, the conjugate symmetric part of the frequency spectrum is to be computed.
ConjFlipBooleanIf True, the conjugate symmetric part of the frequency spectrum will be placed in 0.5..1.0 Fs (as returned by the FFT), and not between -0.5..0.0 Fs.
ContinuousBooleanIf True, the component will pass on the udpate request to the connected component.
CrossSpectralBooleanIf True, calculate the cross spectrum and not the transfer function.
CZTTSpectrumCZTHolds Chirp Z-transform configuration.
DCDumpBooleanIf True, the DC component will be removed from the signal prior to the transform to the frequency domain.
DtDoubleReturns the distance in seconds between two consecutive samples of the signal on which the frequency spectrum is based.
EditorActiveBooleanReturns True, if the component editor is displayed.
ExpWindowDoubleThe parameter for the exponential windowing function.
FloatPrecisionTMtxFloatPrecisionSet this property to request computation in 32bit/64bit precision with real/complex numbers.
FloatPrecisionLockBooleanSet this property to true to lock changes to FloatPrecision property.
HarmonicsIntegerDefines number of harmonics to be used when calculating statistical parameters from the amplitude spectrum.
HzResDoubleReturns the frequency resolution in Hz.
InputTAnalysisConnector property to obtain a pointer to the TSignal component holding the data to be processed.
IntegrationTIntegrationDefine the integration/differenation of the frequency spectrum.
IsDoubleBooleanSet this property to false, to request computation in 32bit floating point precision, 64bit, if true.
IsSpectrumAnalyzerBooleanReturns true, if the descendant class is derived from TSpectrumAnalyzer.
ItemNumberIntegerNumber to label the object when it is an item in the List.
LengthIntegerDefines the length of the spectrum.
LogarithmicBooleanSet it to True, to obtain the logarithm of the spectrum in dB.
LogBaseDoubleDefines the base of the logarithmic spectrum.
LogScaleDoubleDefines the scaling of the logarithmic spectrum.
LogSpanTLogSpanDefines the span of the logarithmic spectrum in dB.
LogTypeTLogTypeSpecify how to apply the logarithm to the spectrum.
MainlobeWidthIntegerDefines the width of the main lobe. Each frequency component in the frequency spectrum should theoretically be infinitely thin.
MarksTMarkListStores the frequency, amplitude and phase of selected frequency bins.
MaxAmpltDoubleStores the maximum value of the Amplt spectrum found by the MinMaxAmplt method.
MaxFreqIndexIntegerHolds the index at which the maximum amplitude was found by the MinMaxAmplt method.
MaxPhaseDoubleStores the maximum value of the Phase spectrum found by the MinMaxPhase method.
MethodTSpectrumMethodDefines the method to be used for frequency spectrum estimation.
MinAmpltDoubleStores the minimum value of the Amplt spectrum found by the MinMaxAmplt method.
MinPhaseDoubleStores the minimum value of the Phase spectrum found by the MinMaxPhase method.
OnAfterAverageTNotifyEventEvent triggered just after the average has been applied.
OnAfterComplexSpectrumTNotifyEventEvent triggered just after complex spectrum has been computed, but before averaging in the complex domain.
OnAfterUpdateTNotifyEventThe event is triggered after the call to the Update method.
OnBandsUpdateTNotifyEventIf assigned, this event will be called instead of a call to Bands.Update method.
OnBeforeAverageTNotifyEventEvent triggered just before the average is applied.
OnBeforeSpectrumTypeTNotifyEventEvent triggered just before spectrum type is aplied, but after averaging in the complex domain.
OnBeforeUpdateTNotifyEventThe event is triggered just before the call to the Update method.
OnDisplayUpdateTNotifyEventThe event is triggered after the OnAfterUpdate event. Use this event to update any associated charts or graphs or result tables.
OnGetInputTNotifyEventIf the Input property is not assigned, the component will call OnGetInput.
OnNotifyUpdateTNotifyEventThe event is called after a call to InternalUpdate, OnAfterUpdate and OnDisplayUpdate from within the Update method.
OnParameterUpdateTNotifyEventThe event is triggered when ParamUpdate method is called. The ParamUpdate method is usually called by component editors when a value was changed by the user and the editor was "Live".
OnPeaksUpdateTNotifyEventIf assigned, this event will be called instead of a call to Peaks.Update method.
PeaksTSpectrumPeaksAnalyzerPointer to the component that manages peak analysis.
PhaseTVecStores the phase of the spectrum.
PhaseModeTPhaseModeThis property determines how to handle the phase of the frequency spectrum.
PhaseRangeTPhaseRangeSpecify the range of the phase spectrum.
PhaseUnitsTPhaseUnitsDefines the units of phase. (radian, degrees).
PipeStateTPipeStateReturns the state of the pipe after the last update.
ReferenceTReferenceListStores a list of components that have to be notified, when this component is destroyed.
ReportTSpectrumReportHolds the parameters needed to generate a spectrum analysis report. Requires that the descriptor property is properly filled up.
RotationIntegerBefore the frequency analysis, the signal can be circularly rotated by a specified number of samples. Rotation defines the number of samples.
RunningPhaseTRunningPhaseDefines how to remove the constant (running) phase from the phase spectrum.
SamplingFrequencyDoubleDefines the sampling frequency of the signal on which the frequency spectrum is based.
SamplingTimeDoubleDefines the length of the signal on which the frequency spectrum is based in seconds.
ScaleFactorDoubleFrequency spectrum will be scaled by a scale factor.
SidelobeAttDoubleSpecifies the attenuation of the main sidelobe in dB. This parameter applies only, if you use the Kaiser or Chebyshev window.
SpectrumScaleDoubleThe scaling factor applied to the frequency spectrum.
SpectrumTypeTSpectrumTypeSpecifies the spectrum type to be computed.
StatsTSpectrumStatsDefines the parameters for the averaging and statistical analysis.
SuspendNotifyUpdateBooleanSet this property to True, to prevent calling OnNotifyUpdate from the Update Method.
UnwrapPhaseBooleanIf True, the phase of the phase spectrum will be "unwrapped".
UsesInputsBooleanSet it to True to indicate, that valid signals will be connected to the Input or Inputs properties.
WindowTSignalWindowTypeSpecifies the window type to be used. Windows decrease spectral leakage, but also decrease spectral resolution.
ZeroPaddingIntegerDefines the level of zero padding of the source signal.

Methods

NameDescription
AddAdd amplitude and phase of the ASpectrum to the current spectrum.
AllowStreamingReturns the negatated value of BlockAssign.
AmpltEst (4)Returns the phases of the amplitudes at Freq frequencies according to the value of the Peaks property.
AmpltLogEst (2)Converts the amplitude of the frequency spectrum at Freq frequency to dB according to the value of the Peaks property.
AmpltSpectrumCompute amplitude spectrum from X.
AssignAssign values of all published properties from Source.
AssignTemplateAssign values of "template-like" published properties from Source.
BandFlipFlip the frequency spectrum on the frequency axis.
ComplexEst (3)Returns the complex value of the Freq frequencies according to the value of the Peaks property.
ComputeSpectrumCompute the frequency spectrum where the Num is the numerator and Den is the denominator of the transfer function.
ConvergeToMaximum (2)Searches for the closest peaks of the amplitude spectrum.
CopyCopy ASpectrum to the calling spectrum.
DifferentiateDifferentiate the underlying signal in the frequency domain by scaling each amplitude line with a power of its angular frequency.
DivideDivide the calling the spectrum with ASpectrum.
EditorClassTo be overriden in descendanr classses.
FilterPeakFilter the peak defined with a TMarkRecord record stored at position Index within Marks list from Input.Data.
FreqToFreqIndexComputes range checked array indexes in the spectrum from frequency values.
InputsDirtyIf all Inputs[i] are dirty the function returns true.
IntegrateIntegrate the underlying signal in the frequency domain by dividing each amplitude line by a power of its angular frequency, restoring the DC term afterwards.
InternalPullWhen called, the method will pass Update requests recursively to all connected objects.
InvalidateNotifies all connected components that this component has fresh data.
LoadFromStreamLoad the component from Src stream.
LoadTemplateFromFileLoad a template from file.
LoadTemplateFromStreamLoad a template from stream.
LogAmpltCompute the logarithm of the amplitude spectrum and convert to dB.
MarksToStringsConvert marks to strings.
MinMaxCalls MinMaxAmplt and MinMaxPhase.
MinMaxAmpltFind minimum and maximum value of the Amplt spectrum.
MinMaxPhaseFind minimum and maximum value of the Phase spectrum.
MulMultiply the calling the spectrum with ASpectrum.
NFNoise floor in dB: the mean absolute noise line (lines outside the mark guard bands), relative to the largest marked peak.
ParamUpdateThe method can be assigned to some other component even handler, as a notification that a parameter has changed and that Self should consider a recalculation.
PeakApproximate (2)Find the peak nearest to the Freq frequency and return the frequenyc of the newly found peak.
PhaseEst (4)Returns the phase of the frequency spectrum at Freq frequency according to the parameters of the Peaks property.
PhaseSpectrumCompute phase spectrum from X.
PipeResetRecursively processes all connected components backward and calls Reset method.
PowerSpectrumCompute power spectrum from X.
ProcessCompute the frequency spectrum where the SrcNum is the numerator and SrcDen is the denominator of the transfer function.
PullRequest recalculation of the entire chain of all connected components.
PullUntilEndCalls Pull until pipeEnd is returned.
ResetReset is called after loading the data from stream or file.
ResetAveragingReset the frequency spectrum averaging.
RMSRoot-mean-square value reconstructed from the amplitude spectrum.
RMSSpectrumCompute RMS spectrum from X.
SaveTemplateToFileSave template to file.
SaveTemplateToStreamSave template to stream.
SaveToStreamSave the component to Dst stream.
ScaleScale the calling spectrum with Factor.
SetZeroInitialize spectrum to zero.
SFDRSpurious-free dynamic range in dB: the ratio of the largest marked peak to the second-largest marked peak.
SINADSignal-to-noise-and-distortion ratio in dB. Compares the largest marked peak against the noise floor plus every other marked peak.
SizeAssign Length, Complex and SamplingFrequency properties.
SNRSignal-to-noise ratio in dB. Sums the absolute amplitudes of all marked peaks and compares against the sum of the absolute amplitude lines outside the mark guard bands.
SpectrumCompute the spectrum from Input.Data according to the state of the component and place the result in Dst.
SqrSquare the Amplt and Phase of the ASpectrum and copy it to self.
SubtractSubtract ASpectrum from the calling spectrum.
THDTotal harmonic distortion in percent. Returns the RMS of the marked harmonic peaks (all marks after the first, when sorted by frequency, up to Harmonics) relative to the first (fundamental) marked peak.
THDNTotal harmonic distortion plus noise, in percent. Combines the noise floor power with the power of every marked peak except the largest, relative to the largest marked peak.
UpdateRequest recalculation of the data and place the result in Self.
UpdateLogarithmicCall the method after changing the Logarithmic property.
UpdateNotifyCall this method only, if SuspendNotifyUpdate is True.
UpdateSpectrumStatsIf Stats.Recursive was False, calling this method will compute the averaged spectrum and associated statistics.
ValuesToStringsConvert values to strings.