How can I change the pspectrum time units?
Show older comments
Is it possible to change the default time units for a pspectrum spectrogram? In the followig I'd like the time in the time domain view of my waveform (subplot 1) to match the time units from my spectrogram (subplot 2). Seems something that should be easy to change but I can't for the life of my figure it out!
[x, fs] = audioread(filename1);
x = x(:,1);
t = (0:length(x)-1)/fs;
xTable = timetable(seconds(t'),x);
figure
ax1 = subplot(2,1,1);
stackedplot(xTable)
ax2 = subplot(2,1,2);
pspectrum(xTable,'spectrogram','OverlapPercent',0, ...
'Leakage',1,'MinThreshold',-80,)
colorbar(ax2,'off')

Accepted Answer
More Answers (0)
Categories
Find more on Time-Frequency Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!