Question
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.
Expert Answer
Kshitij Singh
PhD Expert
Answered Aug 13, 2026
The option to specify that the DC frequency be at the center of the frequency axis is not available in the Signal Processing Toolbox.
To work around this issue, pass the frequency vector in the call to the SPECTROGRAM function like this:
NFFT = 128; f_vec = [-floor(NFFT/2) : ceil(NFFT/2)-1] * Fs/NFFT; spectrogram(x,hamming(128),64,f_vec,Fs);
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →