
Discrete Fourier and Wavelet Transforms: Mathematical Microscopes for Signal Processing Roe Goodman Rutgers Math Club October 15, 2014 Roe Goodman Discrete Fourier and Wavelet Transforms Continuous (calculus) to Discrete (linear algebra) analog signal f (t)(a ≤ t ≤ b) −! digital signal v T v = Q[f (t0); f (t1);:::; f (tN−1)] Q = quantize entries (# bits) tj = a + j∆t with ∆t = (b − a)=N (sample at rate N) Sine Wave and 2−bit Quantization Sine Wave and 4−bit Quantization 1 1 0.8 0.8 0.6 0.6 0.4 0.4 0.2 0.2 0 0 −0.2 −0.2 −0.4 −0.4 −0.6 −0.6 −0.8 −0.8 −1 −1 0 10 20 30 40 50 60 70 80 90 100 0 10 20 30 40 50 60 70 80 90 100 ç more bits gives better sound but needs more memory space Linear algebra model: ∼ N digital signal ! vector in complex vector space = C Roe Goodman Discrete Fourier and Wavelet Transforms Music engraving by LilyPond 2.14.2—www.lilypond.org Periodic Discrete Signals and Transforms 2 Fix integer N ≥ 2 ` [Z=NZ] = vector space of N-periodic signals φ : Z ! C with φ(k + N) = φ(k) for all k 2 Z PN−1 inner product hφ, i = k=0 φ(k) (k)(z = complex conj.) 2 N T ` [Z=NZ] ! C by φ ! x = [φ(0); ··· ; φ(N − 1)] Transform Method N Choose invertible matrix A = [v0; ··· ; vN−1](basis for C ) ∗ ∗ −1 Let v0 ;:::; vN−1 be rows of A (dual basis) −1 T ∗ A-transform X = A x = [c0; ··· ; cN−1] , entries ck = vk x Inversion formula( ?) x = AX = c0v0 + ··· + cN−1vN−1 −1 T ∗ T Example A = A (Orthonormal basis) () vk = v k 2 2 () energy preserved: (x; x) = (X ; X ) = jc0j + ··· + jcN−1j Transform Problem Find the best transform for expanding a particular type of signal x • Large percentage of the coefficients ck in( ?) are small • Replace small ck by 0 to get compressed signalx ~ with small percentage of nonzero coefficients (good approximation to x) Roe Goodman Discrete Fourier and Wavelet Transforms Shift Operator and Sampled Waves 2 N Shift operator For φ 2 ` [Z=NZ] Sφ(k) = φ(k − 1) (S = I ) Problem Find eigenvectorsp for S Let ! = e2πi=N (i = −1) Then !N = 1 and 1; !; !2;:::;!N−1 are the solutions to zN = 1 (roots of unity) N = 8: ↑ Imaginary axis ω2 = i .................... .... ....... t.................... ....... .... .................... ................... ................... ............ ............ .......... .......... ....... ....... 2 2 3 ..... ...... 2πi/8 π π ω ..... ...... ω .....t ..... t..... = e = cos 8 + i sin 8 .... ...... .... .... ..... .... .... ..... .... ... ...... ... ... ...... ... .. ..... ... .. ...... ... .. ..... .. .. .......... 2 .. ..... .... π .. 4 . ..... ... .. 8 . ..... .. 8 . ω = −1 . ..... ω . ... =1 .t ...... .t . ...... −→ Real axis . ...... .. .. ...... .. .. ..... .. .. ..... .. .. ...... .. ... ..... .. ... ..... ... ... ..... ... .... ..... .... .... ..... .... .... ..... .... ..... ..... ..... ..... ....... 5 t..... ......t 7 ....... ....... ω ........ ......... ω ........... ........... ................... ................... .......................................................t............................... ω6 = −i kp 2 Set φp(k) = ! for k; p = 0;:::; N − 1 Then φp 2 ` [Z=NZ] φp = discrete sample of continuous wave fp (frequency p): 2πpti fp(t) = e = cos(2πpt) + i sin(2πpt)(t = k=N) ( low freq. wave when p ≈ 0 (mod N) !p ≈ 1 φp ! high freq. wave when p ≈ N=2 (mod N) !p ≈ −1 Roe Goodman Discrete Fourier and Wavelet Transforms Discrete Fourier Transform 2 Fourier Basis fφ0, φ1, ::: , φN−1g for ` [Z=NZ] −p −p • Eigenvectors for S: Sφp = ! φp (eigenvalue = ! ) ( N if p ≡ q mod N • Orthogonality: hφp; φqi = 0 else 2 Discrete Fourier transform(DFT) of φ 2 ` [Z=NZ] PN−1 −kp 2 φb(p) = hφp; φi = k=0 ! φ(k) for φ 2 ` [Z=NZ] Fourier synthesis: φ = (1=N) φb(0) φ0 + ··· + φb(N − 1) φN−1 Matrix Description (calculated by FFT \Fast Fourier Transform") N N φp ! Ep 2 C (p = 0;:::; N − 1) Fourier basis for C −(j−1)(k−1) Fourier matrix FN = [E0; ··· ; EN−1](j; k entry ! ) 2 1 1 1 1 3 6 1 −i −1 i 7 N = 4: F4 = 6 7 4 1 −1 1 −1 5 1 i −1 −i N If φ ! y 2 C then φb ! Y = FN y and y = (1=N)F N Y Roe Goodman Discrete Fourier and Wavelet Transforms Frequency Analysis Powergraph of Train Whistle Train Whistle 1 peak at 900 890 Hz peak at 0.8 1170 Hz 800 0.6 700 0.4 peak frequency ratios approx. 600 0.2 3:5 peak at 4:5 710 Hz 3:4 0 500 −0.2 400 −0.4 300 −0.6 200 −0.8 100 −1 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 0 time (sec.) 600 800 1000 1200 1400 1600 Frequency (Hz) frequency peaks near 710Hz, 890Hz, 1170Hz (N = 12; 880) analog signal to synthesize peak frequencies f (t) = 0:45 sin(2π∗710t)+0:95 sin(2π∗890t)+0:93 sin(2π∗1170t) What is missing from this model? ç ç (quarter note, rest, half note) d minor chord (whole note) Need time& frequency information! Roe Goodman Discrete Fourier and Wavelet Transforms Music engraving by LilyPond 2.14.2—www.lilypond.org Music engraving by LilyPond 2.14.2—www.lilypond.org Wavelet Approach 2 3 sk (0) 6 sk (1) 7 Given: Digital signal s = 6 7 length N = 2k (level k) k 6 . 7 4 . 5 sk (N −1) Haar Wavelet Transform (pyramid algorithm) (sk )even • Downsample sk −! with (sk )odd 2 3 2 3 sk (0) sk (1) 6 sk (2) 7 6 sk (3) 7 (s ) = 6 7,(s ) = 6 7 (length N=2) k even 6 . 7 k odd 6 . 7 4 . 5 4 . 5 sk (N −2) sk (N −1) 1 • Trend (level k − 1) sk−1 = 2 (sk )even + (sk )odd 1 • Detail (level k − 1) dk−1 = 2 (sk )even − (sk )odd • Iterate on trend sk−1 −! [sk−2; dk−2], sk−2 −! · · · Roe Goodman Discrete Fourier and Wavelet Transforms Multiresolution Analysis level−three signal s level−two trend s level−two detail d Example 3 2 2 60 50 15 50 45 10 40 40 35 5 30 30 0 20 25 10 −5 20 0 15 −10 0 1 2 3 4 5 6 7 0 1 2 3 0 1 2 3 s [0] Three-scale analysis pyramid: 0 d [0] level 0 0 s [0] 1 s [1] 1 d [0] level 1 1 d [1] 1 s [0] s [1] 2 2 s [2] s [3] 2 2 d [2] d [3] d [0] d [1] 2 2 level 2 2 2 s [4] s [7] s [0] s [1] s [2] s [3] 3 s [5] s [6] 3 3 3 3 3 3 3 Three-scale multiresolution analysis s3 −! [s0; d0; d1; d2] Roe Goodman Discrete Fourier and Wavelet Transforms Multiresolution Synthesis and Haar Basis 2 3 s0 (3) 6d07 Three-scale multiresolution synthesis s3 = W 6 7 4d15 Haar three-scale synthesis matrix (8 × 8): d2 (3) 4 2 4 6 W = [u0; v0; v1; S v1; v2; S v2; S v2 S v2](S = shift) 213 2 1 3 2 1 3 2 1 3 617 6 1 7 6 1 7 6−17 6 7 6 7 6 7 6 7 617 6 1 7 6−17 6 0 7 6 7 6 7 6 7 6 7 617 6 1 7 6−17 6 0 7 u0 = 6 7 v0 = 6 7 v1 = 6 7 v2 = 6 7 617 6−17 6 0 7 6 0 7 6 7 6 7 6 7 6 7 617 6−17 6 0 7 6 0 7 6 7 6 7 6 7 6 7 415 4−15 4 0 5 4 0 5 1 −1 0 0 trend coarse detail medium detail fine detail Differences between detail vectors for Haar basis and Fourier basis: • localized in time (multiple time scales) • time shifted and rescaled samples of one function (wavelet) Roe Goodman Discrete Fourier and Wavelet Transforms Mathematical Microscope Wave + Step Function + Noise One-scale Haar transform 1 1 0.5 0.5 0 0 −0.5 −0.5 trend s detail d 9 9 −1 −1 256 512 768 1,024 256 512 768 1,024 Two−scale Haar transform Three−scale Haar transform 1 1 0.5 0.5 0 0 −0.5 trend s detail d −0.5 trend s detail d 8 8 7 7 −1 −1 128 256 384 512 64 128 192 256 10 Pyramid algorithm: x −! [s7; d7; d8; d9](N = 2 ) There are many other mathematical microscopes! Roe Goodman Discrete Fourier and Wavelet Transforms Feature Extraction and Signal Compression Three-scale LeGall wavelet transform (used in JPEG 2000 lossless image compression algorithm) 9 signal −! [s6; d6; d7; d8](N = 2 = 512) Signal with Pops and Static Three−Scale Wavelet Coefficients 1.5 5 s6 0 1 −5 10 20 30 40 50 60 2 0.5 d6 0 −2 0 10 20 30 40 50 60 1 d7 0 −0.5 −1 20 40 60 80 100 120 2 −1 d8 0 −1.5 −2 0 50 100 150 200 250 300 350 400 450 500 550 50 100 150 200 250 • Trend s6 shows the low frequency signal content • Time location of pops is clear at each level of detail • Most of the detail coefficients are small (noise) Roe Goodman Discrete Fourier and Wavelet Transforms Multiresolution Decomposition Three level wavelet synthesis of signal: Let Dj = inverse wavelet transform of details dj (j = 8; 7; 6) S6 = inverse wavelet transform of trend s6 512 Then original signal = D8 + D7 + D6 + S6 (each term in C ) 2 1 D8 0 −1 0 100 200 300 400 500 600 2 1 D7 0 −1 0 100 200 300 400 500 600 0.2 D6 0 −0.2 0 100 200 300 400 500 600 2 S 6 0 −2 0 100 200 300 400 500 600 Roe Goodman Discrete Fourier and Wavelet Transforms Wavelet Filtering and Compression Filtering by RemovingFiltering Waveletby Removing Details Wavelet and Noise Details and Noise 2 2 1 1 0 0 −1 −1 original signal original signal −2 −2 0 0100 100200 200300 300400 400500 500600 600 Threshold Compression2 2 1 1 • 97% of detail coefficients in d6, d7 and d8 are less than 0:2.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages19 Page
-
File Size-