Is it possible to add an option to the SPECTROGRAM function to return/ display the DC frequency in the center of the axis in the Signal Processing Toolbox 6.11 (R2009a)? When I execute the following commands to get the SPECTROGRAM plot: % sample rate Fs = 1024; % number of samples of signal to generate N = 4192; % complex sinusoid frequency (negative) Fc = -128; % generate complex sinusoid Ts = 1/Fs; n = 0:N-1; t = n*Ts; x = exp(1i*2*pi*Fc*t); % the frequency reported by plot is not Fc but 1024 + Fc; spectrogram(x,hamming(128),64,128,Fs); The plot shows only positive frequencies. I know that I can pass the frequency vector to view the negative frequency components as well but an option to specify that the center of the axis should be the DC frequency would be much easier to use.
Kshitij Singh answered .
2025-11-20
NFFT = 128; f_vec = [-floor(NFFT/2) : ceil(NFFT/2)-1] * Fs/NFFT; spectrogram(x,hamming(128),64,f_vec,Fs);