II. Short-time Fourier Transform II-A Definition Short-time Fourier transform (STFT) Alternative definition 參考資料 [1] S. Qian and D. Chen, Section 3-1 in Joint Time-Frequency Analysis: Methods and Applications, Prentice-Hall, 1996. [2] S. H. Nawab and T. F. Quatieri, “Short time Fourier transform,” in Advanced Topics in Signal Processing, pp. 289-337, Prentice Hall, 1987.
STFT Inverse of the STFT: To recover x(t), where w(t1 – t) 0. For the alternative definition,
The mask function w(t) always has the property of (a) even: w(t) = w(t), (通常要求這個條件要滿足) (b) max(w(t)) = w(0), w(t1) w(t2) if |t2| > |t1| (c) w(t) 0 when |t| is large w(t) = (t) (triangular function) w(t) = exp(a|t|b) (hyper-Laplacian function) t = 1 t = 1 Max[(t)] = 1
II-B Rec-STFT Rectangular mask STFT (rec-STFT) Inverse of the rec-STFT where t – B < t1 < t + B The simplest form of the STFT Other types of the STFT may require more computation time than the rec-STFT.
II-C Properties of the Rec-STFT (1) Integration (recovery): (a) (b) when v B < t < v + B, = 0 otherwise
(2) Shifting property (橫的方向移動) (3) Modulation property (縱的方向移動)
(4) Special inputs: (1) When x(t) = (t), when –B < t < B, otherwise (2) When x(t) = 1 思考: B 值的大小,對解析度的影響是什麼?
(5) Linearity property If h(t) = x(t) + y(t) and H(t, f ), X(t, f ) and Y(t, f ) are their rec-STFTs, then H(t, f ) = X(t, f ) + Y(t, f ). (6) Power integration property (7) Energy sum property (Parseval’s theorem)
思考: (1) 哪些性質 Fourier transform 也有? (2) 其他型態的 STFT 是否有類似的性質? Shifting Modulation
Example: x(t) = cos(2 t) when t < 10,
II-D Advantage and Disadvantage Compared with the Fourier transform: All the time-frequency analysis methods has the advantage of: The instantaneous frequency can be observed. All the time-frequency analysis methods has the disadvantage of: Higher complexity for computation
Compared with other types of time-frequency analysis: The rec-STFT has an advantage of the least computation time for digital implementation but its performance is worse than other types of time-frequency analysis.
II-E STFT with Other Windows (1) Rectangle (2) Triangle (3) Hanning (4) Hamming (5) Gaussian -B B -B B
(6) Asymmetric window -B1 t = 0 B2 t-axis B1 B2 應用: seismic wave analysis, collision detection (The applications that require real-time processing) onset detection
動腦思考: Are there other ways to choose the mask of the STFT? Which mask is better? 沒有一定的答案
II-F Spectrogram STFT 的絕對值平方,被稱作 Spectrogram
附錄二:使用 Matlab 將時頻分析結果 Show 出來 可採行兩種方式: (1) 使用 mesh 指令畫出立體圖 (但結果不一定清楚,且執行時間較久) (2) 將 amplitude 變為 gray-level,用顯示灰階圖的方法將結果表現出來 假設 y 是時頻分析計算的結果 image(abs(y)/max(max(abs(y)))*C) % C 是一個常數,我習慣選 C=400 或 image(t, f, abs(y)/max(max(abs(y)))*C) colormap(gray(256)) % 變成 gray-level 的圖 set(gca,‘Ydir’,‘normal’) % 若沒這一行, y-axis 的方向是倒過來的
set(gca,‘Fontsize’,12) % 改變橫縱軸數值的 font sizes xlabel('Time (Sec)','Fontsize',12) % x-axis ylabel('Frequency (Hz)','Fontsize',12) % y-axis title(‘STFT of x(t)','Fontsize',12) % title 計算程式執行時間的指令: tic (這指令如同按下碼錶) toc (show 出碼錶按下後已經執行了多少時間) 註:通常程式執行第一次時,由於要做程式的編譯,所得出的執行時間會比較長 程式執行第二次以後所得出的執行時間,是較為正確的結果