SR Calculation and Spectral Estimation [S&T Appendix A] or, How not to make a mess of an FFT Make sure the input is located in an FFT bin 1 Window the data! A Hann window works well. Compute the FFT 3 SR = power in signal bins / power in noise bins 4 If you want to make a spectral plot i. Apply sine-wave scaling ii. State the noise bandwidth (BW) iii. Smooth the FFT 1
Fourier Transform: xt () If is sampled FT and DFT (1) xt () X ( ) xnt ( ) xnt ( ) e j nt n Estimation of spectrum: DFT / FFT 1 j ntf ( ) ( ) k k ( ) k( ) n X f xnt e xnt h n where f k / ( T), k=, 1,,..., -1 k h ( n) k j kn /, e n,otherwise
FT and DFT () Generally, in Fourier Transformation, the rule is Sampled Periodic If x( nt ) is not periodic with period T, the DFT calculates the spectrum of a discontinuous signal -- bad estimate! 3
FT and DFT (3) Another problem: convolution introduces noise folding in windowed spectrum: (a) Convolution process implied by truncation of the ideal impulse response. (b) Typical approximation resulting from windowing the ideal impulse response. 4
Example: two two-tone tone signal Time domain input of the example before (a) and after windowing (b). Spectra with and without windowing. 5
Windowing i General window (T=1): 1 W ( f ) w ( n ) e n Common windows: j fn 6
Windowing Σ data is (usually) not periodic Just because the input repeats does not mean that the output does too! A finite-length data record = an infinite record multiplied by a rectangular window: wn ( ) = 1, n < Windowing is unavoidable. Multiplication in time is convolution in frequency W( f) --------------- W() (db) 1 3 4 5 6 7 8 9 Frequency response of a 3-point rectangular window Slow roll-off out-of-band Q. noise appears in-band 1.15.5.375.5 ormalized Frequency, f 7
4 Example Spectral Disaster Rectangular window, = 56 Out-of-band quantization noise obscures the notch! db 4 Windowed spectrum 6.5.5 ormalized Frequency, f 8 Actual Σ spectrum W( f) w
Window Comparison = 16 W( f) --------------- W() 1 (db) 3 Rectangular 4 5 6 7 8 9 Hann Hann 1.15.5.375.5 ormalized Frequency, f 9
Window Properties Window Rectangular Hann wn ( ), n = 1,,, 1 ( wn () = otherwise) umber of non-zero FFT bins w = wn ( ) W() = wn ( ) w 1 BW = ------------- 1/ 1.5/ 35/18 W(). MATLAB s hanning function causes spectral leakage of tones located in FFT bins unless you add the optional argument periodic. Use Σ Toolbox function ds_hann. 1 πn 1 cos--------- --------------------------- Hann πn 1 cos--------- --------------------------- 1 3 5 3/8 35/18 / 3/8
Window Length, eed to have enough in-band noise bins to 1 Make the number of signal bins a small fraction of the total number of in-band bins <% signal bins >15 in-band bins Make the SR repeatable = = = 3 OSR 64 OSR 56 OSR yields std. dev. ~1.4 db. yields std. dev. ~1. db. yields std. dev. ~.5 db. > 3 OSR = 64 OSR is recommended This is all you need to know to do SR calculations. If you want to make spectral plots, you need to know more 11
Spectrum of a Sine Wave plus oise Various ( dbfs ) Ŝ x () f 1 3 dbfs Sine Wave = 6 = 8 = 1 = 1 dbfs oise SR = db 3 db/ octave 4.5.5 ormalized Frequency, f 1
Scaling and oise Bandwidth FFT scaled such that a full-scale (FS) sine wave ( A = FS ) yields a -db spectral peak: Ŝ x ( f) = 1 n = wn ( ) xn ( ) e jπfn ---------------------------------------------------- ( FS 4)W() oise Floor depends on (!) A sine-wave-scaled FFT is fine for showing spectra, but is ill-suited for displaying spectral densities. Vertical axis is really dbfs/bw, where BW is the bandwidth over which the noise power has been integrated Think of the spectrum as representing the amount of power in a frequency band whose width is BW. BW = k, where k depends on the window type. 13 FFT sine-wave scale factor
An FFT is like a Filter Bank x The FFT can be interpreted as taking 1 sample from the outputs of complex FIR filters: h () n h 1 () n h k () n y ( ) = X( ) y 1 ( ) = X() 1 y k ( ) = X( k) h k () n e jπk -------- n =, n <, otherwise h 1 () n y 1 ( ) = X( 1) BW is the effective bandwidth of these filters 14
oise Bandwidth For a filter with frequency response W( f) BW W( f) f f BW = W( f) d f ---------------------------- W( f ) 15
oise Bandwidth of a Rectangular FFT W k f h k () n = exp j-------- πk n 1 ( f ) = h k () n exp( πfn j ) n = k = ---, W k ( f ) = 1 = W k BW ( f ) BW is the same for each FFT bin filter 16 1 n = = w k () n = W k ( f) d f = ------------------------------ = ----- = W k ( f ) 1 --- [Parseval]
oise Bandwidth of a Hann-Windowed FFT Use the filter associated with FFT bin wn ( ) = π 1 cos ----- n --------------------------------- 1 FFT -1 --- --- 4 +1 3 w = -------, W() 8 BW w = ------------- = W() = --- 1.5 ------ 17
Example Σ Spectrum 5 th -order TF, OSR=5, Hann window, no averaging (dbfs/bw) 4 6 Large PSD variance Ŝ x () f 8 1 Expected TF (scaled) BW = 9.x1 5 1.1..3.4.5 ormalized Frequency, f 18
Smoothed Spectrum and SR Calculation dbfs/bw 4 6 8 spectrum from logsmooth 4 He ( πif ) BW ----------------------------------------- 3( nlev 1) 6 dbfs signal 1 1 1 3 1 1 1 BW =.1, BW = 9.x1 5 f 15 dbfs/bw average in-band noise density BW/BW = 3.5 db Quantization oise Power = 15 + 3.5 = 74.5 dbfs SQR = 6 ( 74.5) = 68.5 db 19
Manual SQR Prediction The noise term is HE. The rms value of H in the band of interest, σ H, can be evaluated using rmsgain. Since = for all quantizers, σ 1 e = ----- = --. 1 3 σ The in-band noise power is therefore H σ e σ ------------ = -------------- H. OSR 3OSR The signal power is impossible to predict using the linear model, but is usually around 3 dbfs. This corresponds to a power of ( nlev 1) 4. 3( OSR) ( nlev 1) SQR peak 1log 1 ----------------------------------------------- db. 4σ H