How can I plot a spectrogram with dbV/sqrt(Hz) power scale?

6 Ansichten (letzte 30 Tage)
Samuel Pereira
Samuel Pereira am 24 Mai 2019
Beantwortet: AR am 23 Apr. 2025
Hello, All!
I have a time domain signal and I want to plot its spectrogram using "spectrogram" Matlab command. However, the power unit must be dbV/sqrt(Hz) (this unit is, normally, used for plotting noise spectrogram). I took a look at Matlab "spectrogram" command help and I realize it plots the spectrogram with db/Hz. Do you have any idea about how I can change this unit? Any idea?
Thank you very much!
Sam

Antworten (1)

AR
AR am 23 Apr. 2025
Hi Samuel,
I have noticed the same thing. By default, “spectrogram” function returns the power spectral density, db/(rad/sample). For noise analysis it is much more informative to display in dBV/√Hz, which corresponds to voltage spectral density.
We can do the conversion by following the steps below:
1. Compute the spectrogram to get the complex STFT output.
fs = 1000; % Sampling frequency
t = 0:1/fs:1-1/fs; % Time vector
x = randn(size(t)); % White noise signal (1V RMS)
% Window and overlap settings
window = hamming(256);
noverlap = 128;
nfft = 512;
% Spectrogram computation
[S, F, T] = spectrogram(x, window, noverlap, nfft, fs);
2. Normalize the magnitude to obtain amplitude spectral density (V/√Hz).
S_mag = abs(S) / sqrt(fs * sum(window.^2)); % Normalize to get V/√Hz
3. Convert this to dBV/√Hz for plotting.
S_dBV = 20*log10(S_mag); % Convert to dBV/√Hz
clim = [-120 -40]; % Color range for display
figure;
imagesc(T, F, S_dBV, clim);
axis xy;
xlabel('Time (s)');
ylabel('Frequency (Hz)');
title('Spectrogram in dBV/\surdHz');
colorbar;
colormap turbo;
This method gives a spectrogram in the dBV/√Hz units typically used for noise measurements.
I hope this helps you.

Kategorien

Mehr zu Time-Frequency Analysis finden Sie in Help Center und File Exchange

Produkte


Version

R2014b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by