getFrequencyVector
Get the vector of frequencies at which the short-time FFT is computed
Since R2020b
Description
Examples
Get Short-time FFT Frequencies
Get the frequency vector at which the short-time FFT is computed.
Create a dsp.STFT
object. The STFT object is defined with a 'twosided'
frequency range. The frequency vector is defined by the interval [0 Fs] and has the same length as the FFT length, where Fs is the input sample rate.
stf = dsp.STFT
stf = STFT with properties: Window: [512x1 double] OverlapLength: 256 FFTLength: 512 FrequencyRange: 'twosided'
When the input sample rate Fs is not defined, the frequencies are computed in the interval [0, 2].
Using the getFrequencyVector
function, get the vector of frequencies at which the STFT is computed.
freq = getFrequencyVector(stf)
freq = 512×1
0
0.0123
0.0245
0.0368
0.0491
0.0614
0.0736
0.0859
0.0982
0.1104
⋮
When the input sample rate Fs is defined, the frequency vector is defined by the interval [0 Fs].
Fs = 44100; freqFs = getFrequencyVector(stf,Fs)
freqFs = 512×1
104 ×
0
0.0086
0.0172
0.0258
0.0345
0.0431
0.0517
0.0603
0.0689
0.0775
⋮
Input Arguments
stf
— STFT object
dsp.STFT
Short-time FFT object whose frequency vector is computed, specified as dsp.STFT
object.
Fs
— Input sample rate
positive scalar
Input sample rate, specified as a real positive scalar. The STFT frequencies are
computed in the interval determined by Fs
. For more details, see
freq
.
Data Types: single
| double
Output Arguments
freq
— Frequencies
vector
Frequencies at which the short-time FFT is computed, returned as a column vector.
The length of the frequency vector is determined by the FrequencyRange property and the FFTLength.
If you set FrequencyRange
to
'onesided'
and FFTlength
is even, the
frequency vector is of length (
.
If you set the FFTlength
/2)+1FrequencyRange
to 'onesided'
and
FFTlength
is odd, the frequency vector is of length
(
.FFTlength
+1)/2
The frequencies cover the interval [0, Fs
/2]. When
Fs
is not specified, the frequencies range from [0, π].
If you set the FrequencyRange
property to 'twosided'
, the length of the frequency vector is equal
to the value you specify in the FFTlength
property. The frequencies
cover the interval [0, Fs
]. When Fs
is not
specified, the frequencies range from [0, 2π].
Data Types: single
| double
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2020b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)