Calculate spectrogram with logarithmic-spaced frequencies
20 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm trying to calculate a spectrogram where the frequencies are logarithmicaly spaced, instead of the usual linear.
I think my test script follows the documentation, but my two spectrograms are identical and are both clearly using linear frequency spacing.
Am I doing something wrong?
Attached is my test script and the data.
3 Commenti
William Rose
il 21 Dic 2022
Your quesiton is clear. You have provided plots that show what is odd. You have provided your code and you have provided your data. The code shows the issue in question, and does not have a ot of extraneous things going on which distract from the quesiton at hand. It would be great if all quesitons on this site were as well posed as yours.
Risposta accettata
Più risposte (1)
William Rose
il 21 Dic 2022
@dormant, I agree that the bottom plot in your example, which should have the frequencies evenly spaced on a log scale, appears to have frequencies that are evenly spaced on a linear scale, contrary to what you expect and what you want. The help for spectrogram, for the "f" option, says "Cyclical frequencies, specified as a vector. f must have at least two elements, because otherwise the function interprets it as nfft. The units of f are specified by the sample rate, fs." I think this means f should be specified as frequencies normalized by fs. (Which is interesting, since Matlab's filtering routines normalize frequencies by the Nyquist frequency.) Your specification of f is not normalized by fs. Perhaps your f vector is ignored because the values are not all less than 1, which they should be, according to the help quoted above.
3 Commenti
William Rose
il 23 Dic 2022
@dormant, Thank you for shairng your results. I'm glad you like the scalogram.
Even with the scalogram, the frequencies still appear to be linearly spaced, not log-spaced. I say this because the scalogram plot with a logarithmic frequency axis shows finer divisions at higher frequencies than at lower frequencies. In this respect the scalogram plot is not diferent than the spectrogram plots in your original post, which you did not like, due to the linear spacing of frequency samples.
I agree with you that the scalogram appears to have better resolution (better time-bandwidth product) than the spectrogram. I would have to compare spectrograms and scalograms of signals with simple, well defined time-varying frequency content, before having confidence in this conclusion. I am not fond of wavelets due to the difficulty in interpreting the results, and because the mother wavelet choice is somewhat arbitrary and will influence the results.
Vedere anche
Categorie
Scopri di più su Time-Frequency Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!