public class TCrossSpectrumAnalyzer : TSpectrumAnalyzer
Performs cross spectrum analysis.
Cross spectrum analysis is used most to determine transfer function of the system, determine the presence of non-linearities in the analyzed system with the coherence and determine frequency spectrums of Input and Output. The coherence is defined as:
coherence = (| E( X * conj(Y) ) |)/( ) | E(X) | * | E(Y) |
Transfer function is defined as:
tf = (E( | Y | ))/(E( | X | ))
where X is the complex frequency spectrum of the signal entering the system and Y is the complex frequency spectrum of the signal exiting the system.
The component features two modes of operation: Recursive and non-recursive.
- In Recursive mode (Recursive property = True), all the spectral parameters are update for every call to the Update method. This mode can be used to run cross spectral analysis on-line in real time, if you enable infinite exponential averaging.
- In Non-recursive mode (Recursive property = false), only averaging is performed when calls are made to the Update method. Once the averaging has finished, CrossAnalyzer.Update method must be called to calculate the actual spectra and a call to UpdateSpectrum will place the correct spectrum in the Amplt/Phase property. This approach is more CPU efficient then the first.
Because cross spectral analysis is based on averaging, you can not change the parameters of the frequency spectrum of already averaged data.
Properties
| Name | Type | Description |
|---|---|---|
| Active | Boolean | Set active to false to suppress the propagation of the Pull request and the subsequent call to the Update method. |
| ActualZeroPadding | Double | Ready only. Returns the ratio between the original signal length and the length of the analyzed signal padded with zeros. |
| Amplt | TVec | Stores the amplitude of the spectrum. |
| ArOrder | Int32 | Defines the order for the autogressive spectral estimators. |
| Averages | Int32 | Used to store the number of averages made. |
| Bands | TSpectrumBandsAnalyzer | Holds the parameters for the frequency bands. |
| BandWidth | Double | Returns the bandwidth of the spectrum in [Hz]. |
| BandwidthH | Double | Returns the upper bandwidth edge of the signal. |
| BandwidthL | Double | Returns the lower bandwidth edge of the signal. |
| BlockAssign | Boolean | Block streaming of specific properties when storing only a "template". |
| Complex | Boolean | Set this property to true, to request computation using complex numbers. |
| ComplexSpectrum | TVec | This property returns a pointer to the scaled averaged complex cross spectrum. |
| ConjExtend | Boolean | If True, the conjugate symmetric part of the frequency spectrum is to be computed. |
| ConjFlip | Boolean | If 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. |
| Continuous | Boolean | If True, the component will pass on the udpate request to the connected component. |
| CrossAnalyzer | TCrossAnalyzer | Holder for all the storage and settings required by the cross spectral analysis. |
| CrossSpectral | Boolean | If True, calculate the cross spectrum and not the transfer function. |
| CZT | TSpectrumCZT | Holds Chirp Z-transform configuration. |
| DCDump | Boolean | If True, the DC component will be removed from the signal prior to the transform to the frequency domain. |
| Dt | Double | Returns the distance in seconds between two consecutive samples of the signal on which the frequency spectrum is based. |
| EditorActive | Boolean | Returns True, if the component editor is displayed. |
| ExpWindow | Double | The parameter for the exponential windowing function. |
| FloatPrecision | TMtxFloatPrecision | Set this property to request computation in 32bit/64bit precision with real/complex numbers. |
| FloatPrecisionLock | Boolean | Set this property to true to lock changes to FloatPrecision property. |
| Harmonics | Int32 | Defines number of harmonics to be used when calculating statistical parameters from the amplitude spectrum. |
| HzRes | Double | Returns the frequency resolution in Hz. |
| Input | TAnalysis | Connector property to obtain a pointer to the TSignal component holding the data to be processed. |
| Integration | TIntegration | Define the integration/differenation of the frequency spectrum. |
| IsDouble | Boolean | Set this property to false, to request computation in 32bit floating point precision, 64bit, if true. |
| IsSpectrumAnalyzer | Boolean | Returns true, if the descendant class is derived from TSpectrumAnalyzer. |
| ItemNumber | Int32 | Number to label the object when it is an item in the List. |
| Length | Int32 | Defines the length of the spectrum. |
| Logarithmic | Boolean | Set it to True, to obtain the logarithm of the spectrum in dB. |
| LogBase | Double | Defines the base of the logarithmic spectrum. |
| LogScale | Double | Defines the scaling of the logarithmic spectrum. |
| LogSpan | TLogSpan | Defines the span of the logarithmic spectrum in dB. |
| LogType | TLogType | Specify how to apply the logarithm to the spectrum. |
| MainlobeWidth | Int32 | Defines the width of the main lobe. Each frequency component in the frequency spectrum should theoretically be infinitely thin. |
| Marks | TMarkList | Stores the frequency, amplitude and phase of selected frequency bins. |
| MaxAmplt | Double | Stores the maximum value of the Amplt spectrum found by the MinMaxAmplt method. |
| MaxFreqIndex | Int32 | Holds the index at which the maximum amplitude was found by the MinMaxAmplt method. |
| MaxPhase | Double | Stores the maximum value of the Phase spectrum found by the MinMaxPhase method. |
| Method | TSpectrumMethod | Defines the method to be used for frequency spectrum estimation. |
| MinAmplt | Double | Stores the minimum value of the Amplt spectrum found by the MinMaxAmplt method. |
| MinPhase | Double | Stores the minimum value of the Phase spectrum found by the MinMaxPhase method. |
| OnAfterAverage | TNotifyEvent | Event triggered just after the average has been applied. |
| OnAfterComplexSpectrum | TNotifyEvent | Event triggered just after complex spectrum has been computed, but before averaging in the complex domain. |
| OnAfterUpdate | TNotifyEvent | The event is triggered after the call to the Update method. |
| OnBandsUpdate | TNotifyEvent | If assigned, this event will be called instead of a call to Bands.Update method. |
| OnBeforeAverage | TNotifyEvent | Event triggered just before the average is applied. |
| OnBeforeSpectrumType | TNotifyEvent | Event triggered just before spectrum type is aplied, but after averaging in the complex domain. |
| OnBeforeUpdate | TNotifyEvent | The event is triggered just before the call to the Update method. |
| OnDisplayUpdate | TNotifyEvent | The event is triggered after the OnAfterUpdate event. Use this event to update any associated charts or graphs or result tables. |
| OnGetInput | TNotifyEvent | If the Input property is not assigned, the component will call OnGetInput. |
| OnGetInputSpectrum | TNotifyVecEvent | Event returning the custom computed frequency spectrum to be used for computation of the input spectrum. |
| OnGetOutputSpectrum | TNotifyVecEvent | Assign the event returning the custom computed frequency spectrum to be used for computation of the output spectrum. |
| OnNotifyUpdate | TNotifyEvent | The event is called after a call to InternalUpdate, OnAfterUpdate and OnDisplayUpdate from within the Update method. |
| OnParameterUpdate | TNotifyEvent | The 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". |
| OnPeaksUpdate | TNotifyEvent | If assigned, this event will be called instead of a call to Peaks.Update method. |
| OnUpdateSpectrum | TNotifyEvent | This event is called from the UpdateSpectrum routine. The event is called after the spectrum data is updated and before the chart is updated. |
| Output | TSignal | Assign "output" of the system being analyzed. |
| Peaks | TSpectrumPeaksAnalyzer | Pointer to the component that manages peak analysis. |
| Phase | TVec | Stores the phase of the spectrum. |
| PhaseMode | TPhaseMode | This property determines how to handle the phase of the frequency spectrum. |
| PhaseRange | TPhaseRange | Specify the range of the phase spectrum. |
| PhaseUnits | TPhaseUnits | Defines the units of phase. (radian, degrees). |
| PipeState | TPipeState | Returns the state of the pipe after the last update. |
| Reference | TReferenceList | Stores a list of components that have to be notified, when this component is destroyed. |
| Report | TSpectrumReport | Holds the parameters needed to generate a spectrum analysis report. Requires that the descriptor property is properly filled up. |
| Rotation | Int32 | Before the frequency analysis, the signal can be circularly rotated by a specified number of samples. Rotation defines the number of samples. |
| RunningPhase | TRunningPhase | Defines how to remove the constant (running) phase from the phase spectrum. |
| SamplingFrequency | Double | Defines the sampling frequency of the signal on which the frequency spectrum is based. |
| SamplingTime | Double | Defines the length of the signal on which the frequency spectrum is based in seconds. |
| ScaleFactor | Double | Frequency spectrum will be scaled by a scale factor. |
| SidelobeAtt | Double | Specifies the attenuation of the main sidelobe in dB. This parameter applies only, if you use the Kaiser or Chebyshev window. |
| SpectrumScale | Double | The scaling factor applied to the frequency spectrum. |
| SpectrumType | TSpectrumType | Specifies the spectrum type to be computed. |
| Stats | TSpectrumStats | Defines the parameters for the averaging and statistical analysis. |
| SuspendNotifyUpdate | Boolean | Set this property to True, to prevent calling OnNotifyUpdate from the Update Method. |
| UnwrapPhase | Boolean | If True, the phase of the phase spectrum will be "unwrapped". |
| UsesInputs | Boolean | Set it to True to indicate, that valid signals will be connected to the Input or Inputs properties. |
| Window | TSignalWindowType | Specifies the window type to be used. Windows decrease spectral leakage, but also decrease spectral resolution. |
| ZeroPadding | Int32 | Defines the level of zero padding of the source signal. |
Methods
| Name | Description |
|---|---|
| Add | Add amplitude and phase of the ASpectrum to the current spectrum. |
| AllowStreaming | Returns 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. |
| AmpltSpectrum | Compute amplitude spectrum from X. |
| Assign | Assign values of all published properties from Source. |
| AssignTemplate | Assign values of "template-like" published properties from Source. |
| BandFlip | Flip 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. |
| ComputeSpectrum | Compute 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. |
| Copy | Copy ASpectrum to the calling spectrum. |
| Differentiate | Differentiate the underlying signal in the frequency domain by scaling each amplitude line with a power of its angular frequency. |
| Divide | Divide the calling the spectrum with ASpectrum. |
| EditorClass | To be overriden in descendanr classses. |
| FilterPeak | Filter the peak defined with a TMarkRecord record stored at position Index within Marks list from Input.Data. |
| FreqToFreqIndex | Computes range checked array indexes in the spectrum from frequency values. |
| InputsDirty | If all Inputs[i] are dirty the function returns true. |
| Integrate | Integrate the underlying signal in the frequency domain by dividing each amplitude line by a power of its angular frequency, restoring the DC term afterwards. |
| InternalPull | When called, the method will pass Update requests recursively to all connected objects. |
| Invalidate | Notifies all connected components that this component has fresh data. |
| LoadFromStream | Load the component from Src stream. |
| LoadTemplateFromFile | Load a template from file. |
| LoadTemplateFromStream | Load a template from stream. |
| LogAmplt | Compute the logarithm of the amplitude spectrum and convert to dB. |
| MarksToStrings | Convert marks to strings. |
| MinMax | Calls MinMaxAmplt and MinMaxPhase. |
| MinMaxAmplt | Find minimum and maximum value of the Amplt spectrum. |
| MinMaxPhase | Find minimum and maximum value of the Phase spectrum. |
| Mul | Multiply the calling the spectrum with ASpectrum. |
| NF | Noise floor in dB: the mean absolute noise line (lines outside the mark guard bands), relative to the largest marked peak. |
| ParamUpdate | The 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. |
| PhaseSpectrum | Compute phase spectrum from X. |
| PipeReset | Recursively processes all connected components backward and calls Reset method. |
| PowerSpectrum | Compute power spectrum from X. |
| Process | Compute the frequency spectrum where the SrcNum is the numerator and SrcDen is the denominator of the transfer function. |
| Pull | Request recalculation of the entire chain of all connected components. |
| PullUntilEnd | Calls Pull until pipeEnd is returned. |
| Reset | Reset is called after loading the data from stream or file. |
| ResetAveraging | Reset the frequency spectrum averaging. |
| RMS | Root-mean-square value reconstructed from the amplitude spectrum. |
| RMSSpectrum | Compute RMS spectrum from X. |
| SaveTemplateToFile | Save template to file. |
| SaveTemplateToStream | Save template to stream. |
| SaveToStream | Save the component to Dst stream. |
| Scale | Scale the calling spectrum with Factor. |
| SetZero | Initialize spectrum to zero. |
| SFDR | Spurious-free dynamic range in dB: the ratio of the largest marked peak to the second-largest marked peak. |
| SINAD | Signal-to-noise-and-distortion ratio in dB. Compares the largest marked peak against the noise floor plus every other marked peak. |
| Size | Assign Length, Complex and SamplingFrequency properties. |
| SNR | Signal-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. |
| Spectrum | Compute the spectrum from Input.Data according to the state of the component and place the result in Dst. |
| Sqr | Square the Amplt and Phase of the ASpectrum and copy it to self. |
| Subtract | Subtract ASpectrum from the calling spectrum. |
| THD | Total 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. |
| THDN | Total 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. |
| Update | The method is overriden to provide support for the CrossAnalyzer.Recursive property. |
| UpdateLogarithmic | Call the method after changing the Logarithmic property. |
| UpdateNotify | Call this method only, if SuspendNotifyUpdate is True. |
| UpdateSpectrum | Copy the spectrum specified by CrossAnalyzer.Transform property to Self.Amplt. and also performs peak and frequency band analysis, if specified. |
| UpdateSpectrumStats | If Stats.Recursive was False, calling this method will compute the averaged spectrum and associated statistics. |
| ValuesToStrings | Convert values to strings. |
Events
| Name | Description |
|---|---|
| OnAfterAverageEvent | Event triggered just after the average has been applied. |
| OnAfterComplexSpectrumEvent | Event triggered just after complex spectrum has been computed, but before averaging in the complex domain. |
| OnAfterUpdateEvent | The event is triggered after the call to the Update method. |
| OnBandsUpdateEvent | If assigned, this event will be called instead of a call to Bands.Update method. |
| OnBeforeAverageEvent | Event triggered just before the average is applied. |
| OnBeforeSpectrumTypeEvent | Event triggered just before spectrum type is aplied, but after averaging in the complex domain. |
| OnBeforeUpdateEvent | The event is triggered just before the call to the Update method. |
| OnDisplayUpdateEvent | The event is triggered after the OnAfterUpdate event. Use this event to update any associated charts or graphs or result tables. |
| OnGetInputEvent | If the Input property is not assigned, the component will call OnGetInput. |
| OnGetInputSpectrumEvent | Event returning the custom computed frequency spectrum to be used for computation of the input spectrum. |
| OnGetOutputSpectrumEvent | Assign the event returning the custom computed frequency spectrum to be used for computation of the output spectrum. |
| OnNotifyUpdateEvent | The event is called after a call to InternalUpdate, OnAfterUpdate and OnDisplayUpdate from within the Update method. |
| OnParameterUpdateEvent | The 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". |
| OnPeaksUpdateEvent | If assigned, this event will be called instead of a call to Peaks.Update method. |
| OnUpdateSpectrumEvent | This event is called from the UpdateSpectrum routine. The event is called after the spectrum data is updated and before the chart is updated. |