Finite-Length Discrete Transforms
Finite-Length Discrete Transforms
Orthogonal Transforms
Let x[n] denote a length-N time [k ]with domain sequence denoting the coefficient of its Npoint orthogonal transform. The general form of the orthogonal transform pair is of the form
N1
N 1
n= 0
[ k, n ] [ l,n ] = 1, l=k 0 l k
{ }
x [ k ]=
x [ n ] [ k, n ] , 0 k N 1
The above condition are said to be orthogonal to each other The verification of this equation in book page 200
n= 0
1 x [ n ]= N
N 1
x [ n ] [ k, n ] , 0 k N 1
n= 0
Definition - The simplest relation between a length-N sequence x[n], defined for 0nN-1, and its DTFT X(ej) is obtained by uniformly sampling X(ej) on the -axis between 02 at k= 2k/N, 0kN-1
From the definition of the DTFT we thus have
N1 n=0
Note: X[k] is also a length-N sequence in the frequency domain The sequence X[k] is called the discrete Fourier transform (DFT) of the sequence x[n] Using the notation WN= e-j2/N the DFT is usually expressed as:
N1
X [ k ]=
j2k / N
X [ k ]= x [ n ] e
x [ n ] W kn N , 0 k N 1
, 0 k N 1
n=0
Fourier
kn X [ k ] W N , 0 n N 1
x [ n ]= cos( 2 r n N ) , 0 n N 1
Where is r is an integer in the range 0 n N-1
k= 0
As can be seen from the above expression, the inverse DFT x[n] can be a complex sequence even when the DFT X[k] is real sequence.
X [k ]
1 j2rn / N j2rn / N x [ n ]= (e +e ) 2 1 rn rn (W +W N N) 2
4
Matrix Relations
The DFT samples defined by
N1
X [ k ]= 1 2
g [ n ] W kn N
N1
n=0
N 1 n= 0
( r k ) n W + N
r+k ) n W (N
n= 0
X [ k ]=
x [ n ] W kNn , 0 k N 1
n=0
0 k N 1
X=DN x
( k ) n W = N
n= 0
Where X is the vector composed of the N DFT samples and x is the vector of N input samples
we get
DN = 1 1
1 1
1 W1 N W2 N W (NN 1 )
1 W2 N W4 N
( N 1) W2 N
1 W (NN 1 )
( N 1) W2 N
W (NN 1 )
DN = 1
1 1
1 1 W N
2 W N
1 2 W N
4 W N
1
(N1) W N 2( N 1) W N
( N 1) W N
2
( N 1) 2( N 1) 1 W W N N
]
6
1 x [ n ]= N
N 1
kn X [ K ]W N , 0 n N 1
Note
1 D N =
k= 0
1 D N N
Relation Between the DTFT and the DFT and Their Inverses Relation with DTFT
The FT e
jn
X (e )=
N 1 n= 0
n=
x[ n]e
jn
= x [ n ] e jn
limit the extent of the summation to N points and evaluate the continuous function of frequency at N equally spaced points
N 1
X (e
2 =X = k N
( k ) =X k =
x [ n ] e
j2kn / N
n=0
Relation Between the DTFT and the DFT and Their Inverses
X (e
j k
N1
)=
x[ n]e
n=0
jk n
N1
x [ n ] e j2kn/ M
n= 0
Thus is essentially an Mpoint DFT Xe[k] of the length-M sequence xe[n] The DFT Xe[k] can be computed very efficiently using the FFT algorithm if M is an integer power of 2 The function freqz employs this approach to evaluate the frequency response at a prescribed set of frequencies of a DTFT expressed as a rational function in e-j
X (e )
j k
x e [ n ]= x [ n ] , 0 n N 1 0, N n M 1
Then
X (e
j k
M1
)=
x e [ n ] e j2kn / M
n= 0
Relation Between the DTFT and the DFT and Their Inverses
X ( e j )=
N 1
=k = 2k / N , 0 k N 1
Given the N-point DFT X[k] of a length-N sequence x[n], its DTFT X(ej) can be uniquely determined from X[k]
1 N
n= 0 N 1
1 N
n= 0 N 1
x [ n ] e jn
kn jn X [ k ]W N ]e N 1 j ( 2k / N ) n
k= 0
X [k] e
k= 0
n= 0
S
5.3 Relation Between the DTFT and the DFT and Their Inverses
To develop a compact expression for the sum S, let Hence
r=e
Then
j ( 2k / N )
S= r n
( (
) )
rS= r n = 1 + r n +r N 1 rn +r N 1 =S+r N 1
Or, equivalently,
Therefore
X ( e j ) 1 N
N 1
S rS= ( 1 r ) S= 1 r
k= 0
( (
N 2k 2 N 2k 2N
) )
e j [ 2k / N ) ][( N 1)/ 2 ]
Relation Between the DTFT and the DFT and Their Inverses
Thus
j k
Y [ k ] =X ( e
) =X ( e j2k / N ) =
x[ ]e
j2k / N
x [ ] W k N
{X ( e j )}
k
y [ n ]=
1 N
N1 k 0
N1
Y [ k ] W Nkn
kn x [ ]W k N WN
These N frequency samples can be considered as an N-point DFT Y[k] whose N- point IDFT is a length-N sequence y[n] now
1 y [ n ]= N
=
k 0 = N 1
1 N
k= 0
x[ ]
W Nk ( n )
X ( e )=
x[ ]e
1 N
N 1 n 0
1, forr=n+mN k ( n r ) = ( W N 0, otherwise
Relation Between the DTFT and the DFT and Their Inverses
we arrive at the desired relation Thus if x[n] is a length-M sequence with MN, then y[n]= x[n] , for 0nN-1 Example 5.6 Let {x[n]}={0 1 2 3 4 5}
y [ n ]=
m=
x [ n+mN ] , 0 n N 1
Thus y[n] is obtained from x[n] by adding an infinite number of shifted replicas of x[n], with each replica shifted by an integer multiple of N sampling instants, and observing the sum only for the interval 0nN-1 To apply
By
sampling its DTFT X(ej) at k=2k/4, 0k3 and then applying a 4-point IDFT to these samples, we arrive at the sequence y[n] given by
0n3
y [ n ]=
m=
x [ n+mN ] , 0 n N 1
To finite-length sequences, we assume that the samples outside the specified range are zeros
Circular Convolution
This operation is analogous to linear In computing yL[n] we have assumed that both length-N sequence have convolution, but with a subtle been zero-padded to extend their difference lengths to 2N-1 Consider two length-N sequences, The longer form of y [n] results from L g[n] and h[n], respectively the time-reversal of the sequence h[n] and its linear shift to the right
Their linear convolution results in a length-(2N-1) sequence yL[n] given The first nonzero value of yL[n] is by yL[0]= g[0]h[0] ,and the last nonzero value is
N1
y L [ n ]=
g [ m ] h [ n m ] , 0 n 2N 2
yL[2N-2]= g[N-1]h[N-1]
m=0
Circular Convolution
Definition: To develop a convolution-like operation resulting in a length-N sequence yC[n] , we need to define a circular time-reversal, and then apply a circular time-shift Since the operation defined involves two length-N sequences, it is often referred to as an N-point circular convolution, denoted as
convolution
is
y C [ n ]=
m=0
g [ m ] h [ n m N ] ,
0 n N 1
Tabular Method
Consider the evaluation of y[n]= h[n] g[n] where {g[n]} and {h[n]} are length-4 sequences First, the samples of the two sequences are multiplied using the conventional multiplication method as shown on the next slide
[ ][
yC [ 0 ] h[ 0 ] h [ N 1 ] h[ N 2 ] yC [ 1 ] h[ 1 ] h[ 0 ] h [ N 1] h[ 1] h[ 0 ] yC [ 2 ] = h [ 2 ] yC [ N 1 ] h [ N 1 ] h[ N 2] h [ N 3]
h[1] g[ 0] h[ 2 ] g [ 1 ] h[3] g[ 2] h[ 0 ] g [ N 1 ]
][ ]
Circular Convolution
The partial products generated in the 2nd, 3rd, and 4th rows are circularly shifted to the left as indicated above
Circular Convolution
The modified table after circular shifting is shown below
Thus
yc[0]=g[0]h[0]+ g[3]h[1]+ g[2]h[2]+ g[1]h[3] yc[1]=g[1]h[0]+ g[0]h[1]+ g[3]h[2]+ g[2]h[3] yc[2]=g[2]h[0]+ g[1]h[1]+ g[0]h[2]+ g[3]h[3] yc[3]=g[3]h[0]+ g[2]h[1]+ g[1]h[2]+ g[0]h[3] The definition of circular conjugatesymmetric sequence and circular conjugate-antisymmetric sequence.
The samples of the sequence { yc[n]} are obtained by adding the 4 partial products in the column above of each sample
Circular conjugate-symmetry
Circular conjugate-antisymmetry
Where, Xcs[n] is its circular conjugate-symmetric part and Xca[n] is its circular conjugate-antisymmetric part, defined by:
Where, Xev[n] is its circular even part and Xca[n] is its circular odd part, defined by:
(2) Antisymmetric sequence Type1: Symmetric impulse response with odd length. Type2: Symmetric impulse response Since the length N of a sequence with even length can be either even or odd, four types Type1: Anti-symmetric impulse of geometric symmetry are defined: response with odd length. Type1: Anti-symmetric response with even length. impulse
which results in
Now, x[0]=-x[8], x[1]=-x[7], x[2]=-x[6], x[3]=-x[5] and x[4]=0 The phase is now The antisymmetry introduces a phase shift of /2
which results in
Similarly, the Fourier transform of Type 4 linear phase antisymmetric sequence of even length-N is
j=ej/2 introduces a
In general, the DFT X[k] of a finite sequence x[n] is a sequence of complex numbers and can be expressed as
X [ k ]= X re [ k ] + j
X im [ k ]
Real and imaginary parts of the DFT sequence can be found as:
Duality Theorem If the N-point DFT of the length-N sequence g[n] is G[k], then
Linearity Theorem Consider a sequence x[n] obtained by a linear combination of g[n] and h[n]
Circular Convolution Theorem The N-point DFT Y[k] of the length Nsequence is given by
Circular Time Shifting Theorem The DFT of the circularly time shifting sequence x[n] is given by
Parsevals Theorem The total energy of a length-N sequence g[n] can be computed by summing the square of the absolute values of the DFT.
Linear Convolution using the DFT Since a DFT can be efficiently implemented using FFT algorithms, it is of interest to develop methods for the implementation of linear convolution using the DFT Let g[n] and h[n] be two finite-length sequences of length N and M, respectively Define two length-L (L = N + M 1) sequences
Let G[k] and H[k] denote their espective N-point DFTs Define a length-N complex sequence
Thus
the
DFT-based
Where
where h[n] is a finite-length sequence of length M and x[n] is an infinite length (or a finite length sequence of length much greater than M)
Thus
where
Consider implementing the following convolutions using the DFT-based method, where now the DFTs (and the IDFT) are computed on the basis of (N + M 1) points
In general, there will be an overlap of M 1 samples between the samples of the short convolutions h[n] xr-1[n] and h[n] xm[n] for (r 1)N n rN + M 2
The above procedure is called the overlap-add method since the results of the short linear convolutions overlap and the overlapped portions are added to get the correct final result
Next form
Computing the above for m = 0, 1, 2, 3, . . . , and substituting the values of xm[n] we arrive at Then, we reject the first M 1 samples of wm[n] and abut the remaining M M + 1 samples of wm[n] to form yL[n], the linear convolution of h[n] and x[n] If ym[n] denotes the saved portion of wm[n], i.e.,
In general, the N-point DFT X[k] of length-N real sequence is a complex sequence satisfying the symmetry condition
* X[k] = X kN
The DFT of a real symmetric and antisymmetric finite sequence is a product of a linear phase term and a real amplitude function.
For N even, the DFT samples X[0] and X[N-2]/2 are real and distinct. The remaining N-2 DFT samples are complex and only half of these samples are distinct For N odd, the DFT samples x[0] is real and the remaining N-1 DFT samples are complex, of which only half of these samples are distinct
Orthogonal transform is based on converting an arbitrary sequence into either a symmetric or an anti-symmetric sequence and then extracting the real orthogonal transform coefficients from the DFT, the transform develop via this approach is called discrete cosine transform (DCT)
To develop the expression for the DCT for symmetric periodic sequence, consider type 1 DCT.
let x[n] be a length-N sequence defined for 0nN-1. First, x[n] is extended to a length-2N sequence by zero padding.
{ x[n] } = { a bc d }
then the extracted periodic is given by
x [ n ],0 n N 1 x [ n ] e xe [n] 0 , N n 2 N 1
Next, type-2 symmetric sequence y[n] of length 2N is formed from xe[n] according to
{ y[n] } = { a b cdcb }
To develop the Type-2 DCT, extract y[n] of the symmetric periodic sequence
y [ n ]x [ n ] x [ 2 N 1 n ] e e 0 n 2 N 1
{ y[n] } = { a b c d d c b a }
x [ n ], 0 n N 1 x [ 2 N 1 n ], N n 2 N 1
y[n]
y [ n ]y [ 2 N 1 n ]
the 2N-point DFT Y[k] of the length2N sequence y[n] is thus
2 N 1 kn Y [ k ] y [ n ] W , 0 n 2 N 1 2 N n 0
Y [ k ]
x [ n ] W
n0
W W
N1 kn 2 N n0
N1 k/2 2 N n0
2 x [ n ]cos
k ( 2 n1 ) , 2 N
0 k 2 N1
The Type-2 N point DCT,
N 1
rewrite
N 1 2 N 1 kn y [ n ] W 2 N, n0 2 N 1 kn x [ 2 N1 n ] W , 2 N n0
Y [ k ]
kn y [ n ] W 2 N n0 N 1 kn x [ n ] W , 2 N n0
X DCT [ k ]=
2x [ n ] cos
n= 0
k ( 2n + 1 ) , 2N
0 k 2N 1
The samples of XDCT[k] are real for real sequence x[n]
0k 2 N1
k ( 2 n1 ) cos 2 N
are orthogonal to each other. To verify that x[n] is indeed the IDCT of XDCT[k]
where 1 / 2 [ k ] 1
k 0 1 kN 1
DCT
x [ k ] X DCT [ k ]
it can be shown that
N 1 1 k ( 2 n1 ) m ( 2 n1 ) cos cos N 2 N 2 N n0
0 kN 1
The IDCT of an N-point DCT XDCT[k] can also be computed using the DFT
k / 2 W X [ k ] 2 N DCT
1 , k m0 , 1 /2 , k m0 , 0 , k m ,
0 k N 1 k N ,
Y [ k ]0 ,
k / 2 W X [ 2 N k ], N 1 k 2 N 1 , 2 N DCT
2 N 1 1 kn y [ n ] y [ k ] W , 0 n 2 N 1 properties that are useful in certain 2 N 2 N k 0 application. Assume all time domain
We get
1 1 N 1 2 N 1 ( n ) k1 ( n ) k 1 2 2 y [ n ] X [ k ] W X [ 2 N k ] W DCT 2 N DCT 2 N 2 N 2 N k 0 k N 1
g [ n ] G [ k ] DCT
DCT
1 1 X [ k ] W X [ k ] W 2 N 2 N
1 2 N 1 ( n ) k 2 DCT 2 N k 0
N 1
h [ n ] H [ k ] DCT
Linearity Property
The DCT XDCT[k] of a sequence obtained by a linear combination of two sequences, g[n] and h[n]. Where and arbitrary constants.
DCT
1 1 X [ k ] W X [ k ] W 2 N 2 N
N 1 X [ 0 ]1 k ( 2 n 1 ) DCT X [ k ] cos DCT 2 NN 2 N k 1 0 n 2 N 1
g [ n ]h [ n ] G [ k ]H [ k ] DCT DCT
x [ n ]y [ n ]0 n N 1
The Haar Transform The discrete-time Haar transform is derived by sampling the continousetime Haar function.
The set of Haar function hl(t) contains N numbers, with N a power-of-2 positive integer: that is N=2v+1, where v 0. In defining the Haar function, the integer subscript l is uniquely represented as a function of two non negative integer variable, r and s.
r l 2 s1
g [ n ] G[ k ]
DCT * DCT
Energy Preservation Property The energy preservation property of the DCT is similar to the persevals relation for the DFT.
N 1
N 1 1 2 | g [ n ] | [ k ] | G [ k ] | DCT 2 N n 0 k 0 2
h ( t )h ( t ) 1 , 0 t1 0 0 , 0
s1 s 0 . 5 2 , t , r r 2 2 . 5 s r/2 s 0 2 t r r 2 2 0 otherwise for 0 t 1
r/2
To derive transform
the
high
order
Haar
H v 2 1
, v 1 . 2 I 1 1
v / 2 v 2
H 1 1 v 2
h t) h t) l( r ,s(
Where denotes the kronecker product and IK is the KK identity. The N-point transform XHaar of length N sequence x[n] is given by
Definition The NN discrete-time Haar transform matrix HN is obtained by discretizing the Haar functions at discrete values of t, given by t = n/N, 0 n N-1 where
h H . x , Haar N
l = 2r + s 1
T
matrix
is
1 t H N N
x
Haar
1t H X N Haar N
H v 2 , n H v1 2 I v 2
1 2 1 2
1 2 1 2
, v0 .
Consider the energy compaction proper of the DFT, the DCT and the Haar transform. The Discrete Fourier Transform
1 2 | H [ k ] | Haar N k 0
N 1
Energy Compaction Properties If L samples of the transform with X [ k ], 0 k DFT 2 indices in the range R are set to zero N1 L N1 L with L < < N and if x(m) [n] denotes the ( m ) X [ k ] 0 , k inverse of the modified transform, then DFT 2 2 a measure of the energy compaction N1 L X [ k ], k N1 property DFT
N1 L
N 1 1 ( m ) 2 ( L ) | x [ n ]x [ n ] | N k 0
1 ( m ) kn X [ n ] X [ k ] W DFT N k 0
( m ) DFT
N 1
1 k ( 2 n 1 ) ( m ) X [ n ] [ k ] X [ k ] cos DCT N 2 N
Hence the approximation error is
N 1 1 ( m ) 2 ( L ) | x [ n ]x [ n ] | DCT N k 0
N 1 L ( m ) DCT k 0
approximation
N 1 1 ( m ) 2 ( L ) | x [ n ]X [ n ] | DFT N k 0
X [ k ]
Haar ( m ) Haar
X [ k ] 0 k N 1 L N L k N 1
1 ( m ) x [ n ] h [ k , n ] X [ k ] Haar Haar N k 0
N 1 1 ( m ) 2 ( L ) | x [ n ]x [ n ] | Haar N k 0
X [ k ]
DCT ( m ) DCT
X [ k ] 0 k N 1 L N L k N 1