STFTSpectrum (FPScript)
Computes the Short-Time Fourier Transform (STFT) time-frequency spectrum.
Syntax
STFTSpectrum(Signal, [ SpectrumType = SPECTRUM_DBNORM ], [ Window = WIN_HANNING ], [ Adjustment ], [ SegmentLength = 0 ], [ OverlapOrGap = 50 ], [ FFTLength = 0 ], [ dBLimit = 0 ] [ , MaxFrequencies = 0 ])
The syntax of the STFTSpectrum function consists of the following parts:
Part |
Description |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Signal |
The data to be analyzed. The data must have a constant sampling rate and must not contain void values. Permitted data structures are data series und signal. All real data types are permitted, except calendar time und time span. Void values are not permitted in this argument. For the X component additional restrictions do apply.The values must have a constant positive spacing. Void values are not permitted in this argument. If the argument is a list, then the function is executed for each element of the list and the result is also a list. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SpectrumType |
The spectral format to be computed. The argument SpectrumType can have the following values:
If this argument is omitted, it will be set to the default value SPECTRUM_DBNORM. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Window |
The fixed or adjustable data window to be applied to the data. The argument Window can have the following values:
If this argument is omitted, it will be set to the default value WIN_HANNING. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Adjustment |
The one-sided Fourier width as a multiple of the frequency interval. The valid range is window specific within 1.0 to 6.0. The default is 1.5 for a tapered cosine window and 3.0 for all other adjustable data windows. Permitted data structures are scalar value. All real data types are permitted. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SegmentLength |
The length of individual FFTs. The valid range is 2 to data length / 2. The default value is 0 which sets the segment length to the double of the square root of the data length, rounded up to the next power of two. Permitted data structures are scalar value. All integral data types are permitted. If this argument is omitted, it will be set to the default value 0. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
OverlapOrGap |
If this argument is specified as a positive number, then it specifies the percentage overlap of the individual data segments. If it is specified as a negative number, then its amount specifies the gap between the individual data segments in samples. Permitted data structures are scalar value. All real data types are permitted. The value must be less or equal to 95. If this argument is omitted, it will be set to the default value 50. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FFTLength |
The length of the Fourier transforms. Zero padding applies if the FFT length is greater than the segment length. The valid range is from the segment length to the maximum limit of FFT. The default value is 0, which sets the FFT length equal to the segment length. Permitted data structures are scalar value. All integral data types are permitted. The value must be greater or equal to 0 and less or equal to 2147483648. If this argument is omitted, it will be set to the default value 0. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dBLimit |
The dB baseline to be applied to a dB spectrum. The range is between 1.0 dB to 120.0 dB, or 0 for no baseline. Permitted data structures are scalar value. All real data types are permitted. The argument is transformed to the unit dB. The value must be greater or equal to 0.0 dB and less or equal to 120.0 dB. If this argument is omitted, it will be set to the default value 0. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MaxFrequencies |
The maximum count of frequency values in the STFT (power-normalized PSD spectrum only). The range is 10 to 10000, or 0 for no limit. Permitted data structures are scalar value. All real data types are permitted. If this argument is omitted, it will be set to the default value 0. |
Remarks
The result always has the data structure signal series with Z-component.
The X component contains the frequencies and the Z component contains the starting times of the segments. If the argument Signal is a data series, then the X component of the result contains Nyquist-normalized frequencies and the Z component contains the index values of the segment beginnings.
The following graph visualizes the settings for segment length, overlap and FFT length:
Available in
FlexPro Professional, Developer Suite
Examples
TransposeMatrix(STFTSpectrum(Signal, SPECTRUM_DBNORM, WIN_HANNING + WIN_NORMALIZEPOWER, 2, 256, 50, 0, 20, 0))
Calculates the STFT spectrum of a signal and then transposes the result so that frequencies are assigned to the Z component. dB normalized is selected as the spectrum type. The window applied is Cos2 Hanning -31 dB W=2. The FFT length is set to the segment length with a value of 256. This is an example from the Time-Frequency Spectral Analysis Tutorial.
See Also
Time-Frequency Spectral Analysis Object