필터 지우기
필터 지우기

Spectrogram: HOW TO CONTROL ZERO-PADDING for individual fft's of an ULTRA LONG sequence

조회 수: 12 (최근 30일)
Hello,
I have a long audio sequence x at sampling rate fs, and would like to perform a spectrogram on it; (fs = 44000, and this is a several second recording).
I want this spectrogram
  • to be built from half-overlapping individual audio snips of say 3000 audio data points
  • I want to have the individual FFT of say length nFFT= 2^16 , i.e. with a very substantial amount of zero padding (for very fine interpolation purpose).
So in this case I want a specific control on the zero-padding, i.e. a zero-padding that is NOT governed by the criterium nFFT > size(x).
Can this be done using matlab spectrogram ?

채택된 답변

Chunru
Chunru 2021년 12월 15일
"doc spectrogram" for details.
[x, fs] = audioread('RockGuitar-16-44p1-stereo-72secs.wav');
whos
Name Size Bytes Class Attributes fs 1x1 8 double x 3195904x2 51134464 double
% zeros will be padded automatically
% win overlap nfft
spectrogram(x(:,1), 3000, 1500, 2^16, fs);

추가 답변 (2개)

Fabia Bayer
Fabia Bayer 2021년 12월 15일
Hello,
if I understand your question correctly, you want segments of length n_w = 3000, each overlapping by 1500 samples, and then zero-padded with 2^16-3000 zeros for your FFT.
This should be technically possible using
n_w = 3000;
n_fft = 2^16
window = ones(1, n_w) %no window - add here whichever window of length n_w, i.e. hamming, hanning etc you prefer
spectrogram(x, window, [], n_fft)
However, you may want to think about whether this solution actually computes what you are looking for. A high amount of zero-padding increases the frequency resolution of your result, but it also dismorphs yor result. A signal that is zero almost everywhere, as the one you specify, will reflect this in its FFT. So it may be worth thinking again whether adding this enormous zero padding truly is superior to increasing the frequency resolution by taking longer (potentially more overlapping) segments from your signals.

Bjorn Gustavsson
Bjorn Gustavsson 2021년 12월 15일
Yes, in principle, zero-padding is used by spectrogram if nFFT is larger than the window-length.
HTH

카테고리

Help CenterFile Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by