Sei sulla pagina 1di 23

95

IV. Implementation
IV-A Method 1: Direct Implementation
STFT

X t , f w t x e j 2 f d

Converting into the Discrete Form


t = nt, f = mf, = pt

X nt , m f w ( n p ) t x p t e
j 2 pmt f
t
p

Suppose that w(t) 0 for |t| > B, B/ t = Q


n Q
X nt , m f w ( n p ) t x p t e
j 2 pmt f
t
p n Q

Problem Gabor transform Q = ?


96
Constraint for t (The only constraint for the direct implementation method)
To avoid the aliasing effect,
t < 1/2, is the bandwidth of ?

There is no constraint for f when using the direct implementation method.


97
Four Implementation Methods
(1) Direct implementation
Complexity:

t-axis T sampling points, f-axis F sampling points


(2) FFT-based method
Complexity:

(3) FFT-based method with recursive formula


Complexity:

(4) Chirp-Z transform method


Complexity:
98
(A) Direct Implementation
Advantage simple, flexible
Disadvantage higher complexity

(B) DFT-Based Method


Advantage lower complexity
Disadvantage with some constraints

(C) Recursive Method


Advantage
Disadvantage

(D) Chirp Z Transform


Advantage
Disadvantage
99
IV-B Method 2: FFT-Based Method
Constraints tf = 1/N,
N = 1/(tf) 2Q +1: (tf )
n Q 2 pm
X n t , m f
j
w ( n p ) x p e
p n Q
t t
N
t

Note that the input of the FFT has less than N points (others are set to zero).
N 1 2 mn
j
Standard form of the DFT Y m y n e N

n 0
2 ( Q n ) m N 1 2 qm
X n t , m f t e
j
x qe
j
, q = p(nQ) p = (nQ)+q
N N
1
q 0

where x1 q w (Q q)t x (n Q q)t for 0 q 2Q,


x1(q) = 0 for 2Q < q < N.
100

N 1 2 qm
j
(1) Matlab FFT x qe
q 0
1
N

(2) n
2 ( Q n ) m N 1 2 qm
X n t , m f t e
j
x qe
j
N N
1
q 0
101
t = n0t, (n0+1) t, (n0+2) t, , (n0+T-1)t

f = m0 f, (m0+1) f, (m0+2) f, , (m0+F-1)f

Step 1: Calculate n0, m0, T, F, N, Q


Step 2: n = n0
Step 3: Determine x1(q)
m = f/ f
Step 4: X1(m) = FFT[x1(q)] page 99
m1 = mod(m, N)+1
Step 5: Convert X1(m) into X( nt, mf)

X nt , m f X1 ? ?

Step 6: Set n = n+1 and return to Step 3 until n = n0+T-1.


102
IV-C Method 3: Recursive Method
A very fast way for implementing the rec-STFT
n Q 2 pm
X n t , m f
j
(n n1recursive) x p e
p n Q
t
N
t

X (n 1) t , m f
(1) Calculate X(min(n)t, mf) by the N-point FFT
2 ( Q n0 ) m N 1 2 qm
X n0 t , m f t e
j
x qe
j
N
1
N , n0 = min(n),
q 0

x1 q x (n Q q)t for q 2Q, x1(q) = 0 for q > 2Q

(2) Applying the recursive formula to calculate X(nt, mf),


n = n0 +1~ max(n)
X nt , m f X (n 1)t , m f x (n Q 1) t e j 2 ( nQ1) m / N t
T F
x ( n Q ) t e j 2 ( n Q ) m / N t
103
IV-D Method 4: Chirp Z Transform


exp j 2 pmt f exp j p 2 t f exp j ( p m)2 t f exp j m2 t f
For the STFT
n Q
X n t , m f t w ( n p ) t x p t e
j 2 pmt f
t
p n Q

n Q
X n t , m f t e w ( n p ) t x p t e
j m 2 t f j p 2 t f j ( p m )2 t f
e
p n Q
Step 1 multiplication
Step 2 convolution
Step 3 multiplication
104
Step 1 x1 p w (n p)t x pt e
j p t f
2

n-Q p n+Q
n Q
Step 2 X 2 n, m x1 p c m p c m e
j m2 t f

p n Q


Step 3 X nt , m f t e j m2 t f
X 2 n, m

Step 2 linear convolution

Question: Step 2 DFT?


105
Illustration for the Question on Page 104

y[n] x[n k ] h[k ]


k

Case 1
When length(x[n]) = N, length( h[n]) = K, N and K are finite,
length(y[n]) = N+K1,
Using the (N+K1)-point DFTs ()

Case 2
x[n] has finite length but h[n] has infinite length ????
106
y[n] x[n k ] h[k ]
k

Case 2
x[n] has finite length but h[n] has infinite length

x[n] n [n1, n2] N = n2 n1 + 1


h[n]

y[n] x[n k ] h[k ] y[n] (


k
y[n]

y[n] n [m1, m2] M = m2 m1 + 1

h[n] ?
FFT ?
107

y[n] x[n] h[n] x[n k ] h[k ]
k
n2
y[n] x[n] h[n] x[ s ] h[n s ]
s n1

y[n] x[n1 ] h[n n1 ] x[n1 1] h[n n1 1] x[n1 2] h[n n1 2]


x[n2 ] h[n n2 ]
n = m1
y[m1 ] x[n1 ] h[m1 n1 ] x[n1 1] h[m1 n1 1] x[n1 2] h[m1 n1 2]
x[n2 ] h[m1 n2 ]
n = m2
y[m2 ] x[n1 ] h[m2 n1 ] x[n1 1] h[m2 n1 1] x[n1 2] h[m2 n1 2]
x[n2 ] h[m2 n2 ]
108
m1 n2 m1 n1 n2
y[n] x[ s ] h[n s ]
s n1
m1n2+1 m1n1+1
m1n2+2 m1n1+2

n = m1
n s
n = m1 +1
n s m2n2 m2n1

n = m1 +2 n = m2
n s n s

h[k] k [m1 n2, m2 n1]


109
h[k] k [m1 n2 , m2 n1 ]
m2 n1 m1 + n2 + 1 = N + M 1

FFT implementation for Case 2


x1[n] x[n n1 ] for n = 0, 1, 2, , N1
x1[n] 0 for n = N, N + 1, N + 2, , L 1 L=N+M1

h1[n] h[n m1 n2 ] for n = 0, 1, 2, , L1

y1[n] IFFTL FFTL x1[n] FFTL h1[n]

y[n] y1[n m1 N 1] for n = m1, m1+1, m1+2, , m2


110
IV-E Unbalanced Sampling for STFT and WDF
pages 95 and 99

X t , f w t x e j 2 f d

nS Q
X nt , m f w (nS p) x p e
j 2 pm f

p nS Q

where t = nt, f = mf, = p, B = Q ( w(t) 0 for |t| > B),

S = t/ t
(sampling interval for the input signal)
t (sampling interval for the output t-axis) can be different.
However, it is better that S = t/ is an integer.
111
When (1) f = 1/N, (2) N = 1/(f) > 2Q +1: (f)
(3) < 1/2, is the bandwidth of w t x( )
i.e., | FT {w t x( )}| | X (t , f ) | 0 when | f | >

nS Q 2 pm
X n t , m f
j
w (nS p) x p e
p nS Q
N

q = p (nSQ) p = (nSQ) + q
x1 q x (nS Q q) for 0 q 2Q,
x1(q) = 0 for 2Q < q < N.
2 ( Q nS ) m N 1 2 qm
X n t , m f e
j
w (Q q) x q e
j
N N
1
q 0
112
t = c0t, (c0+1) t, (c0+2) t, , (c0+ C -1) t
= c0S, (c0S+S) , (c0S+2S) , , [c0S+ (C-1)S] ,

f = m0 f, (m0+1) f, (m0+2) f, , (m0+F-1) f


= n0 , (n0+1) , (n0+2) , , (n0+T-1) , S = t/
Step 1: Calculate c0, m0, n0, C, F, T, N, Q
Step 2: n = c0
Step 3: Determine x1(q)
Step 4: X1(m) = FFT[x1(q)w((Q-q) )]
Step 5: Convert X1(m) into X( nt, mf)
Step 6: Set n = n+1 and return to Step 3 until n = c0+ C -1.

Complexity = ?
113
IV-F Non-Uniform t
(A) t
(B) X nt , m f X (n 1)t , m f
nt, (n+1) t sampling interval t1
( < t1 < t, t/ t1 t1/ )
page 112
X n t t1 , m f , X nt 2 t1 , m f , , X (n 1) t t1 , m f
(C) X nt k t1 , m f , X (n 1)t (k 1)t1 , m f
sampling interval t2
( < t2 < t1, t1/ t2 t2/ )
114
Gabor transform of a music signal

1000

900

800

700

600

500

400

300

200

100
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6

= 1/44100 ( 44100 1.6077 sec + 1 = 70902


115
(A) Choose t =
running time = out of memory
(B) Choose t = 0.01 = 441 (1.6/0.01 + 1 = 161 points)
running time = 1.0940 sec (2008)

(C) Choose the sampling points on the t-axis as


t = 0, 0.05, 0.1, 0.15, 0.2, 0.4, 0.45, 046, 0.47, 0.48, 0.49, 0.5, 0.55, 0.6, 0.8,
0.85, 0.9, 0.95, 0.96, 0.97, 0.98, 0.99, 1, 1.05, 1.1, 1.15, 1.2, 1.4, 1.6
(29 points)
running time = 0.2970 sec
116
with adaptive output sampling intervals

1000

900

800

700

600

500

400

300

200

100
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
117
Dirac Delta Function

(1) e j 2 t f dt f

(2) t a at (scaling property)



e j 2 t g ( f ) dt g ( f n ) f f n
1
(3)
n
where fn are the zeros of g(f)

(4) t t y t,
0 dt y t0 , (sifting property I)

(5) t t0 y t , t t0 y t0 , (sifting property II)

Potrebbero piacerti anche