What is the unit of frequency in a spectrogram- Hertz or frequency bins?
Ältere Kommentare anzeigen
Is it Frequency in hertz or in bins? If in bins, how do you convert it to Hertz?
Thanks
Antworten (1)
dpb
am 8 Mär. 2014
0 Stimmen
The latter and by using your sampling frequency and sample time.
6 Kommentare
Win
am 8 Mär. 2014
Win
am 8 Mär. 2014
dpb
am 8 Mär. 2014
I'd forgotten about the optional Fs argument to spectrogram, sorry; I don't use it frequently enough.
OK, with a 1 MHz sample rate, what is the Nyquist frequency? Isn't that 500 kHz and doesn't that look suspiciously like your 500000 value?
For Fs as input I'd probably express it in kHz to get smaller integers on the axis. See if that doesn't help.
Win
am 8 Mär. 2014
dpb
am 8 Mär. 2014
Again I reiterate -- fft "knows nuthink" about frequency, it's simply the two-sided DFT of the input in a vector of length N. If you want to plot against a real frequency, you have to create the frequency vector associated with your sampling frequency and sample length. See
doc fft % which shows an example of a PSD and a plot.
Note especially that the DC component is at point N/2+1. Also see
doc fftshift
OTOH, since you used the optional input Fs sample frequency to spectrogram, it normalized the plot to that and handles the display of the single-sided plot automagically for you as a convenience of being a higher-level routine than fft
Read the documentation more carefully and in full on the two specifically and the background information on the FFT in general as well as slowing down and really thinking about what it is that you're actually plotting and computing.
Kategorien
Mehr zu Get Started with Signal Processing Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

