Introduction to Digital slides

Dr. Gal Ben--DavidDavid Winter 2009//20102010

11 Agenda

 Signal and Systems brushbrush--up,up, Poisson formulas  Sampling: Point sampling, Impulse Sampling, BandBand-- pass Sampling, , Shannon reconstruction  DFT --DiscreteDiscrete Fourier Transform, Spectrum analysis, Windows, Zero Padding, Cyclic convolution, Periodic Signals, FFT  Continuous Phase representation, Linear Phase, , All Pass  FIR filters, IRT Method, Windows, Equiripple  IIR Filter, Analog filters, ,  MultirateMultirate,, Decimation, Interpolation

22 Course requirements

 Theoretic Homework (up to 2 students per submisssubmission)ion) --88%%  Matlab exercises (up to 2 students per submission) ––88%%  No grade transfer  Final Exam ––MoedMoed A, B, Miluim --8484%%  Note that for a 170170++ students class we cannot find personal “solutions” for grades (i.e., no oral exams, no extra homework, no special exam dates, ….)  Intensive use of Moodle for announcements, forums, sound files, submission, HW partners, homework, solutions, ask your lecturer

33 Literature

 Malah--RazRaz(Hebrew)

 + Equiripple

 + Multirate

 -- DFT frequency zero padding

 --IIRIIR ChebCheb.,., Elliptic filters will be given in tutorial only  B. Porat,Porat , A Course in Digital Signal Processing, J. Wiley, 1997

44 Analog Signal Processing

ω y( )= 1 x(t) y(t) x()ω 1+ jωRC

In fact R can be purchased (within reasonable price) at 1% precision, while C is 10% accurate. The corner frequency is accurate to ~10% (3-4 bit)

55 Analog Signal Processing

 Legacy ––Resistors,Resistors, Capacitors, Operational AmplifiAmplifiersers  Mostly used for filtering  Simple  Limited in scope  Limited in accuracy  Cannot be adapted  Repeatability problems  Aging  Sensitivity to the environment  Uncertain performance in production units  Variation in performance of units  Sensitive analog traces on PCBs

66 Digital Signal Processing

 Platform  General purpose computers  Dedicated Signal Processors  Dedicated hardware  Accuracy only depends on computer registers  Flexible  Repeatable  Adaptive  May be more sophisticated

77 What is DSP?  Digital Signal Processing – the processing or manipulation of signals using digital techniques

Digital Output Input ADC Signal DAC Signal Processor Signal Analogue Digital to to Digital Analogue Converter Converter Speech Processing

 Speech coding/compression  Speech synthesis  Speech recognition Some Properties of Speech

Vowels

“oo” in “blue” “o” in “spot” “ee” in “key” “e” in “again”

•Quasi-periodic •Relatively high signal power Consonants

“s” in “spot” “k” in “key”

•Non-periodic (random) •Relatively low signal power Speech Coding

64 kbits/s 22.8 kbits/s

13 kbits/s

BTS Speech Coding – Vocoder

Encoder Original Speech

Analysis: • Voiced/Unvoiced decision • Pitch Period (voiced only) • Signal power (Gain)

Pitch Decoder Period Signal Power Pulse Train V/U

G Vocal Tract Model

Synthesized Speech Random Noise Digital Audio

 Standard music CD:

 Sampling Rate: 4444..11 kHz

 1616 --bit samples

 22--channelchannel stereo

 Data transfer rate = 22××1616 ××4444,,100100 = 11..44 Mbits/s

 1 hour of music = 11..44××33,,600600 = 635 MB Audio Coding (Cont’d)  Key standards:

 MPEG: Layers I, II, and III (MP33);); AAC. •• used in DAB, DVD

 Dolby AC33,, Dolby Digital, Dolby Surround.  Typical bit rates for 2--channel stereo:

 6464kbits/skbits/s to 384 kbits/s.  Subband--oror transform--based,based, making use of perceptual masking properties. Image/Video

 Still Image Coding:

 JPEG (Joint Photographic Experts Group): •• Discrete Cosine Transform (DCT) based

 JPEGJPEG20002000:: Wavelet Transform based  Video Coding:

 MPEG (Moving Pictures Experts Group): •• DCTDCT--based,based, •• Interframe and intraframeprediction, •• Motion estimation. •• MPEGMPEG--11,, MPEG--22,MPEG , MPEG--44MPEG

 H.H.261261,, H.H.263263,H.,H.264264

 Applications: Digital TV, DVD, Video conference,etcconference,etc.. Some Other Application Areas

 Image analysis, e.g::e.g  Human recognition,  Optical Character Recognition (OCR);  Restoration of old image, video, and audio signals;  Analysis of RADAR data;  Analysis of SONAR data;  Data transmission (modems, radio, echo cancellation, channel equalization, etc.);  Storage and archiving;  Control of electric motors (!). DSP Devices & Architectures

 Selecting a DSP ––severalseveral choices:

 FixedFixed--point;point;

 Floating point;

 ApplicationApplication--specificspecific devices (e.g. FFT processors, speech recognizers,etcrecognizers,etc.)..).  DSP Manufacturers:

 Texas Instruments ( http://www.ti.com))

 Motorola/Motorola/FreescaleFreescale ((http://www.motorola.com))

 Analog Devices ( http://www.analog.com))

 Israel: DSP Group, ZoranZoran,, ECI, Rafael, Elbit,Elbit , IAI, Comverse, Intel, Microsoft, EltaElta,, MAF--AT,MAF AT, .... Typical DSP Operations – MADD/MACC

• Filtering Convolution • Energy of Signal • Frequency transforms

Pseudo C code for (n=0; n

X RAM Y RAM x(n-i) ai

Multiply/Accumulate

Accumulator

y(n) Sampling and quantization Amplitude

Discrete 50 Continuous 49 48 47 46 45

T 2T Time 2020 Continuous Time Fourier Transform

Continuous time signal

CTFT

Angular frequency ω = 2πf

Sufficient condition

2121 Inverse CTFT

Reconstruction of non continuous point

2222 Dirchlet conditions

In each finite section, x(t) has finite number of non --continuous points. The “jump” is finite

Bounded variation ––FiniteFinite number of extreme points in each finite section

2323 Sinc in time Gate in frequency

Note: X(t) is not absolute integrable

2424 Gate in time Sinc in frequency

The inverse transform

2525 Order 1 Low pass filter

2626 Order 1 Low pass filter

2727 CTFT

2828 CTFT

2929 CTFT

3030 Delta or Unit Impulse Function, δ(t)

 The delta or unit impulse function, δδ((tt))

 Mathematical definition (non(non--purepure version) 0 t ≠ t δ (t − t ) =  0 0 ⋅∞ = 1 t t0

 Graphical illustration

δ(t) 1

t 0 t0

3131 Impulse Function

For f() continuous at τ

Impulse function in time contains all frequencies - same amplitude 3232 DC in time  Impulse in frequency

3333 Harmonic exponentials

3434 COS /SIN

3535 SISO – Single Input – Single Output Systems

A linear Linear system has a zero response for zero stimulus

Time invariant

3636 Linear Time--InvariantInvariant Systems

δ x(t)= (t) System h(t) T

t t If a LTI system is excited by an input x(t) = δ(t), the output is called the impulse response h(t) = T{δ (t)}

3737 Unit Impulse

 Any continuous function can be written as weighted ‘sum’ of impulses as ∞ x(t) = ∫ x(τ )δ (t −τ )dτ −∞

3838 Response to Arbitrary Input

 ∞  y(t) = T{}x(t) = T  ∫ x(τ )δ (t −τ )dτ  −∞  ∞ = ∫ x(τ )T{δ (t −τ )}dτ −∞ But since the system is time invariant T{δ (t −τ )}= h(t −τ ) ∞ y(t) = ∫ x(τ )h(t −τ )dτ −∞ y(t) = x(t)∗h(t) 3939 Convolution

∞ y(t) = ∫ x(τ )h(t −τ )dτ −∞ y(t) = x(t)∗h(t)

x(t)LTI System y(t) h(t)

4040 Properties of the Convolution Integral

 Commutative y(t) = x(t)∗ h(t) = h(t)∗ x(t)  Associative ∗ ∗ = ∗ ∗ {}{}x(t) h1(t) h2 (t) x(t) h1(t) h2 (t)  Distributive ∗ + = ∗ + ∗ x(t) {}h1(t) h2 (t) x(t) h1(t) x(t) h2 (t)

4141 Eigenfunctions of ContinuousContinuous--TimeTime LTI Systems

∞ y(t) = ∫ x(t −τ )h(τ )dτ x(t)=e st LTI System ∞− h(t)

∞ ∞ y(t) = ∫ h(τ )e (ts −τ )dτ = est ∫ h(τ )e−sτ dτ ∞− ∞− = H (s)est = λest

λ is the eigenvalue of the system associated with the eigenfunction e st , a complex constant

4242 Eigenfunctions of ContinuousContinuous--TimeTime LTI Systems

Harmonic input  Harmonic output

0

0

4343

Define

Harmonic in  Harmonic out LTI system changes the amplitude and phase of harmonic signals

4444 LTI Real impulse response systems

4545 Periodic function f (t) f (t) = f (t + kT) ∀ ,t ∀k

t T T

f(t) ⇒ a series of frequencies multiple of 1/T

4646 Orthogonal basis

4747 Single Periodic extension period f (t)

t T CTFT of the single period

The Fourier series coefficients are samples of the CTFT of the single period function Samples in frequency – Periodicity in time 4848 Poisson Sum formula

We get spectral lines

4949 )t(f F(ω)

t ω T

)t(f F(ω)

t

ω T T ω 0

5050 Poisson Sum formula

The formula may be used for arbitrary x I(). For the impulse function

5151 Poisson Sum formula

Impulse train in time – Impulse train in frequency

5252 Sampling “quick and dirty” x(t) X(f)

t BW p(t) P(f) f

t T F=1/T

x(t)p(t) X(f)*P(f) f

t f

Harry Nyquist (1889-1976) – Replicas will not overlap if F>2BW

5353 Parseval equation

Sum of Energy of Single period energy Fourier coefficients

5454 Symmetry for real x(t)

The Fourier series is composed of cosines

5555 Finite Fourier series

Instead of infinite series, we approximate by using 2N-1 elements

Best approximation for the L 2 metric

- Gibbs

5656 Periodic functions and LTI Systems

H( ω)

∞ + ω ⋅ jk ω0 ψ ()kω0 ∑ ak H ()k 0 e k =−∞

The reponse to a periodic function is also periodic

5757 The Discrete time Fourier transform

X f (θ )= X f (θ + 2π )

Existence sufficient condition

Inverse transform

5858 Example

5959 Harmonic functions

6060 DTFT

6161 DTFT

6262 DTFT

6363 Unit sample response

δ x(n)= (n) System h(n) h(n) t Convulution

6464 Response to harmonic signal

Eigenfunction

Frequency response

6565 Discrete time periodic signals

Note that cos signal

is periodic only if rational

6666 Sampling

6767 Sampling --AliasingAliasing

1.2 1 __ 0.8 s(t) = sin(2πf0t)

0.6

0.4 s(t) @ f S

0.2

0 f0 = 1 Hz, f S = 3 Hz -0.2 tt -0.4

-0.6

-0.8 __ -0.8 s1(t) = sin( 8πf0t) -1 -1.2 __ s2(t) = sin(14 πf0t)

s(t) @ f S represents exactly all sine-waves s k(t) defined by: ∈ sk (t) = sin( 2π (f 0 + k f S) t ) , k 

6868 Sampling of continuous time x(t)

Sampling frequency

Sampling period What is the relationship between the CTFT of x(t) and the DTFT of x(n)?

6969 Inverse CTFT

We calculate the infinite integral in sections of 2π/T

XF(ω)

…… ω −3π/T -π/T π/T 3π/T 7070 Compare to

7171 Sampling

7272 Band limited signal. Nyquist condition is met

Nyquist

7373 Band limited signal. Nyquist condition is met

π 2 corresponds to the sampling frequency 7474 Band limited signal. Nyquist condition not met

Aliasing 7575 Sampling low--passpass signals

Continuous spectrum (a) (a) Band-limited signal: frequencies in [-B, B] (f MAX = B).

-B 0 B f

(b) Discrete spectrum No (b) Time sampling frequency repetition.

fS > 2 B no aliasing.

-B 0 B f S/2 f

Discrete spectrum (c) Aliasing & corruption (c) fS 2 B aliasing !

Aliasing: signal ambiguity 0 f S/2 f in frequency domain

7676 Remark

The condition

May be extended to

If no delta component exists at half the sampling frequency

7777 Cos at ffss//22

π

7878 Cos at ffss//22

π

7979 Sinc

For

π 8080 Non band limited signals

8181 Antialiasing filter

(a) Signal of interest (a),(b) Out-of-band noise can aliase Out of band Out of band noise into band of interest. Filter it before! noise

(c) Antialiasing filter -B 0 B f

(b) Passband : depends on bandwidth of interest.

Attenuation A MIN : depends on

-B 0 B f S/2 • ADC resolution ( number of bits N). (c) f AMIN, dB ~ 6.02 N + 1.76 Antialiasing • Out-of-band noise magnitude. Passband filter frequency Other parameters: ripple, stopband frequency... -B 0 B f

8282 UnderUnder--samplingsampling

Using spectral replications to Bandpass signal B reduce sampling frequency f SS centered on f C requirements.

0 fC 2⋅fC +B 2⋅fC −B ≤ fS ≤ f m +1 m ∈ m , selected so that f S > 2B

-fS 0 f S 2f S f fC Example Advantages fC = 20 MHz, B = 5MHz  Without under-sampling fS > 40 MHz. Slower ADCs / electronics needed. With under-sampling fS = 22.5 MHz (m=1);  = 17.5 MHz (m=2); = 11.66 MHz (m=3). Simpler antialiasing filters.

8383 Sampling of continuous time x(t)

Sampling frequency

Sampling period What is the relationship between the CTFT of x(t) and the DTFT of x(n)?

8484 Inverse CTFT

We calculate the infinite integral in sections of 2π/T

XF(ω)

…… ω −3π/T -π/T π/T 3π/T 8585 Compare to

8686 Sampling

8787 Band limited signal. Nyquist condition is met

Harry Nyquist 1889-

1976 8888 Band limited signal. Nyquist condition is met

π 2 corresponds to the sampling frequency 8989 Band limited signal. Nyquist condition not met

Aliasing 9090 Remark

The condition

May be extended to

If no delta component exists at half the sampling frequency

9191 Cos at ffss//22

π 9292 Sin at ffss//22

π

9393 Sinc

For

π 9494 Non band limited signals

9595 Antialiasing filter

(a) Signal of interest

Out of band Out of band noise noise

-B 0 B f (b)

-B 0 B f S/2 (c) f

Antialiasing Passband filter frequency

-B 0 B f

9696 Example Linear Technology Inc. LTC1564 Digitally Controlled Antialiasing Filter

9797 9898 9999 100100 Successive approximation register A/D Acquisition Time

VS Data Output Register ½ LSB

VCSH (t) tACQ

VSH0

t0 tACQ RSW RS Time - SAR VS S1 + CSH

Sample and Hold circuit N-bit DAC “Parasitic” LPF before sampling. RC Designed to be much faster than Fs. What happens with Band pass sampling ?? 101101 Sampled signal

Let us sample the continuous-time non-periodic signal x(t) at equal intervals T, to generate the sequence {…, x(−kT),…, x(−T), x(0), x(T),..., x(kT ), ...}

y(t)

x(t)

∞ ∞ y(t) = ∑ x(kT )⋅δ (t − kT ) = x(t)⋅ ∑δ (t − kT ) k =−∞ k =−∞

102102 Impulse sampling

103103  x(n) is a discrete time series  xxpp(t) is a continuous time signal  x(n) and x pp(t) contain the same information

104104 Poisson formula

Fourier transform of P T(t)

105105 Compare to a pervious result

We obtain the dual Poisson formula

106106 Time ––MultiplyingMultiplying by an impulse train Frequency ––ConvolutionConvolution with an impulse train

107107 Frequency relation between point and impulse sampling

108108 Shannon reconstruction

x(t) is a narrowband signal and sampling is performed at a frequency higher than Nyquist condition

It is possible to reconstruct the original x(t) from its samples by

Claude Elwood Shannon 1916-2001

109109 Proof

Only the main replica applies because we followed the Nyquist rule

110110 using DTFT

and since

QED 111111 Sinc interpolation (non casual)

112112 General interpolation

Interpolation kernel

113113 Condition on the interpolation kernel

Note that for Sinc interpolation kernel the original sample values are kept after reconstruction sum

114114 Ideal reconstruction --frequencyfrequency domain view

115115 Other low pass filters

116116 Zero--orderorder hold

117117 Zero order hold

118118 ZOH – Frequency domain view

119119 ZOH – Frequency domain view

120120 ZOH – Frequency domain view

Ideal reconstruction filter

121121 Recommended homework -- Find (time and frequency) properties of the FirstFirst--orderorder interpolation kernel

Casual ??? 122122 Discrete Fourier Transform

123123 The DTFT

We limit ourselves to time limited signals n=0,1,..,N-1

124124 Sampling in frequency

125125 DFT frequency resolution

Experiment length

126126 Periodic series

limited in time to

its periodic extension

Since the W-s are has period N

127127 Properties

128128 Properties

129129 DFT and DTFT

 The DFT samples on period of the discretediscrete--timetime Fourier transform (DTFT) at NN evenly spaced frequencies fftshift()

130130 Matlab Example: f=0 (DC), N=32--pointpoint DFT

n=n=00::3131;; f=f=00..00;; x = coscos((22*pi*n*f);*pi*n*f); figure(figure(11);); stem(n,xn,x);stem( ); figure(figure(22);); stem(n,absstem( n,abs((fftfft(x)));(x))); % FFT is a fast algorithm to calculate DFT

x(n) |X(k)|

35 1

0.9 30

0.8 25 0.7

0.6 20

0.5 15 0.4

0.3 10

0.2 5 0.1

0 0 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 NOTE: Matlab indexes starting from 1 (i.e x(1) to x(N)) not 0 (i.e. x(0) to x(N-1)) 131131 Matlab Example: f=00..2525,, N=3232--pointpoint DFT

n=n=00::3131;; f=f=00..2525;; x = coscos((22*pi*n*f);*pi*n*f); figure(figure(11);); stem(n,xn,x);stem( ); figure(figure(22);); stem(n,absstem( n,abs((fftfft(x)));(x)));

x(n) |X(k)|

1 16

0.8 14

0.6 12 0.4 10 0.2

0 8

-0.2 6

-0.4 4 -0.6

2 -0.8

-1 0 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35

132132 DFT of Cosine

133133 134134 DFT of cosine

Integral number of cosine periods

135135 Why we do not get “two deltas” ? We calculate DFT on a limited time cosine y(θ) 1

0 θ −θ θ -1 0 0 0 5 10 15 20 25 30

1

0.5

0 * 0 5 10 15 20 25 30

1

0

-1 0 5 10 15 20 25 30

136136 Why we do not get “two deltas” ?

137137 Inverse DFT

138138 Zero padding

139139 Zero padding

Improves DFT frequency inter-sampling spacing (“resolution”). 8 1 6 0.5 time 4 0 2 0 4 8 12 16 -0.5 0 0 1 2 3 4 5bin 6 -1

88 1 66 0.5 4 timetime 4 0 22 0 10 3 20 6 30 9 40 12 50 15 60 18 70 21 80 9024 100 27 110 30 120 00 -0.5 00 12 3 24 6 36 9binbin 1248 -1

140140 Discrete Fourier Transform (DFT)

 The Discrete Fourier Transform (DFT) of a finite length sequence

π N −1 − j2 nk = = N ∈ − X[k] DFT N {}x[n] ∑ x[n]e for k {0,..., N 1} n=0

 The Inverse Discrete Fourier Transform (IDFT) is defined by

π 1 N −1 j2 nk = = N ∈ − x[n] IDFT N {}X [k] ∑ X [k]e for n {0,..., N 1} N k=0  A DFT and IDFT pair is shown as

x[n]←DFT → X [k]

141141 DFT Transformation Matrix

 The DFT can be represented as a symmetric matrix

1 1 1 1 1 1  π W = e j /2 N  −1 −2 −3 −()N −1  N 1 WN WN WN ... WN  = , ji i− )(1( j− )1 FN W = W : : : : : :  N N i, j : row and column indexes  −(N −1) −2( N −1) −3( N −1) −(N −1)2  1 WN WN WN ... WN   This introduces the widelywidely--usedused and convenient notationsnotations

N −1 = −nk ⇒ =  x[0]   X ]0[  X[k] ∑ x[n]W N X FN x     = x ]1[ X ]1[ n 0 x =   X =   N −1  :   :  1 −1   = nk ⇒ =   − x[n] ∑ X[k]W N x FN X x[N − ]1  X [N ]1  N n=0

142142 The DFT matrix is (almost) unitary

− 1 F 1 = F T N N N

143143 DFT Example

 The DFT matrices of dimension 22,, 33,, 4 are as fofollows:llows:

  1 1 1 1  1 1 1  1 1      = −1− j 3 −1+ j 3 1 − j −1 j F2   F = 1  =   1 −1 3 F4    2 2  1 −1 1 −1  −1+ j 3 −1− j 3  1     2 2  1 j −1 − j

= − T 1 1 1 1  1   2  X ]0[  x [1 3 0 2] ,        1 − j −1 j 3 1− 5 j X ]1[ X = F x =    =   =   4 1 −1 1 −1 0   0  X ]2[         X = Tx 1 j −1 − j− 2 1+ 5 j  X ]3[ 

 Where we observe that the real part of XX[[kk] is eveneven--symmetric,symmetric, and the imaginary part is oddodd--symmetricsymmetric ––thethe DFT of the real signal.

144144 DFT Computation Using MATLAB  The functions to compute the DFT and the IDFT are fft and ifft  These functions make use of Fast Fourier Transform ((FFT) algorithms which are computationally highly efficient compared to the direct computation

145145 Simple script file using FFT

%simple example of FFT use %setting up the signal t=0:0.001:0.6; x=sin( 2*pi* 40 *t)+sin( 2*pi* 100 *t) %40 Hz and 100 Hz sine waves added y=x+2*randn(size(t)); %noise added %randn(size(t)) gives an array of normally distributed random entries % that is the same size as t plot(t(1:50),y(1:50)) %plots first 50 points i.e. to 0.05 s title('40 Hz plus 100 Hz corrupted by noise') xlabel('time (seconds)') pause(2) %waits 2 seconds before continuing

146146 Signal plus noise

147147 Simple script file using FFT ptpt22

%the fft and output Y=fft(y,512); %performs the fft. Note 512 elements - power of 2 (2^9) Pyy=abs(Y)/ 512 ; %Y will have complex elements. The power spectrum is real %so do an element by element multiplication by complex conjugate f=1000*(0:256)/512; plot(f,Pyy(1:257)) %we are only interested in half the data points %as the same information is provided in the second half of Pyy title('Frequency content of corrupted signal') xlabel('Frequency (Hz)')

148148 Frequency content

149149 DFT Properties

 Let x [ n ] ← DFT  → X [ k ], y [ n ] ←  DFT  → Y [ k ], h [ n ] ←  DFT  → H [ k ] be lengthlength--NN sequences indexed nn==00,…,,…, N--11..  DFT Properties:

 Linearity: For constant a, b: ax [n] + by [n]←DFT →aX [k] +Y[k]  Real Sequences : If xx[[nn] is real ::

X [k] = X [N − k] and ∠X [k] = −∠X [N − k]

150150 Cyclic time shift

151151 DFT Circular Shift Property

= + x1[n] x[(( n 2)) N ]

152152 Cyclic frequency shift

153153 DFT Properties

 Duality: = − DFT N {X[k]} Nx [N n]  Parseval’s Theorem N −1 N −1 ∑ X[k] 2 = N 2 ∑ x[n] 2 k=0 n=0

154154 Cyclic Convolution

Signals of Length N, n=0,1,…,N-1

Periodic extension

155155 Cyclic Convolution

 Why is cyclic convolution not true linear convolution?  Because a wraparound effect occurs at the “ends”:  The procedure of each pair are summed around the circle.  In a while, it will be seen that y [ n ] = x [ n ] * h [n] can be computed using

N y[n] = x[n]⊗h[n].

156156 Circulant matrix interpretation

157157 Cyclic convolution and DFT

158158 Cyclic convolution and DFT

159159 Cyclic Convolution Example

− = δ − ←DFT → = kn 0 x1[n] [n n0 ] X1[n] WN

− = = kn 0 X 3[k] X1[k]X 2[k] WN X 2[k]

= ⊗ x3[n] x1[n] x2[n] N −1 = − ∑ x1[k]x2[(( n k)) N ] k=0 = − x2[(( n n0 )) N ]

160160 Linear Convolution by DFT

 Linear convolution is desired. The linear convolution can be computed via DFT, with a minor modification.  Method: To compute the linear convolution y[n] = x[n]*h[n] of a sequence xx[n] of length -- NN1 and a sequence hh[[nn] of length -- NN22 via the DFT, form the length NN11 + NN22 --11 zero--paddedzero padded sequences

x[n]; 0 ≤ n ≤ N −1 h[n]; 0 ≤ n ≤ N −1 x [n] =  1 h [n] =  2 a ≤ ≤ + − a ≤ ≤ + −  0 N1 n N1 N2 2  0 N2 n N1 N2 2

N +N −1 = 1 ⊗2 ya[n] xa[n] ha[n] = ≤ ≤ + − x[n]*h[n]; 0 n N1 N2 2

161161 Linear Convolution

Non zero contributions at

162162 Zero padding to length N=N11+N22--11

x[n]; 0 ≤ n ≤ N −1 x [n] =  1 a ≤ ≤ + −  0 N1 n N1 N2 2

y[n]; 0 ≤ n ≤ N −1 y [n] =  2 a ≤ ≤ + −  0 N2 n N1 N2 2

163163 Linear and Cyclic convolution

Non zero for

164164 Non zero regions

− − ≤ − ≤ − − − N n m N2 1 N n + ≥ ≥ − + + N n m N N2 1 n + ≥ ≥ + N n m N1 n

The second term is zero QED

165165 DFT of periodic signals*

x(t) with period T 0 is samples at T=T 0/N (N samples per period)

* Tip – Topic the lecturer is very fond of. Look at exams from previous semesters. 166166 DFT of periodic signals

167167 DFT of periodic signals (aliasing)

For narrowband signals and Nyquist complying sampling

And the signal may be reconstructed from its DFT coefficients

168168 FFT

169169 Top 10

 Monte Carlo method or Metropolis algorithm, devised by John von Neumann, Stanislaw Ulam,Ulam , and Nicholas Metropolis;  simplex method of linear programming, developed by George Dantzig;Dantzig ;  Krylov Subspace Iteration method, developed by MagnusMagnus Hestenes,Hestenes , Eduard StiefelStiefel,, and Cornelius Lanczos;Lanczos ;  Householder matrix decomposition, developed by Alston Householder;  Fortran compiler, developed by a team lead by John Backus;  QR algorithm for eigenvalue calculation, developed by J Francis;  Quicksort algorithm, developed by Anthony Hoare;  Fast Fourier Transform , developed by James Cooley and John Tukey;Tukey ;  Integer Relation Detection Algorithm, developed by Helaman Ferguson and Rodney Forcade;Forcade ; (given N real values XI, is there a nontrivialnontrivial setset of integer coefficients AI so that sum ( 1 <= I <= N ) AI * XI = 00??  Fast Multipolealgorithm, developed by Leslie Greengardand Vladimir Rokhlin;Rokhlin ; (to calculate gravitational forces in an NN--bodybody problemproblem normally requires N^N^22 calculations. The fast multipolemethod uses order N calculations, by approximating the effects of groups of distant particles using multipoleexpansions)

170170 Cooley and Tukey

171171 Performance of the DFT Algorithm

 The DFT requires N2 ((NxNNxN) complex multiplications:

 Each X(k) requires N complex multiplications.

 Therefore to evaluate all the values of the DFT ( X((00)) to X(NX(N--11)) ) NN22 multiplications are required.  The DFT also requires (N--11)*N)*N complex additions:

 Each X(k) requires NN--11 additions.

 Therefore to evaluate all the values of the DFT (N(N--11)*N)*N additions are required.

172172 DFT → FFT

N −1 = −nk ≤ ≤ − X ()k ∑ x[]n WN ; 0 k N 1 n=0

 x[n] = x[x[00],], x[11],x[ ], …, x[N--11]] we assume N even  Divide the sequence x[n] into even and odd sequences:

 x[x[22n]n] = x[x[00],], x[x[22],], …, x[Nx[N--22]]

 x[x[22n+n+11]] = x[x[11],], x[x[33],], …, x[Nx[N--11]]

173173 Decimation-in-Time Factorization

N −1 = ⋅ −kn = L − X[k] ∑ x[n] WN , k 0 ,1, , N 1 and N even n=0 N − pt . DFT = + 2r = r ∑ ∑ Note that : W2N WN n, even n, odd N 2/ −1 N 2/ −1 = −2rk + + −(2r+1)k ∑ x[2r]WN ∑ x[2r 1]WN r=0 r=0 N 2/ −1 N 2/ −1 = −rk + −k ⋅ + −rk ∑ x[2r]WN 2/ WN ∑ x[2r 1]WN 2/ r=0 r=0 N 2/ − pt .DFT ,G(k ) N 2/ − pt .DFT ,H (k )

174174 DFT → FFT  The result is that an N--pointpoint DFT can be divided into two N/N/22 point DFT’s:

N −1 = −nk ≤ ≤ − X ()k ∑ x[]n WN ; 0 k N 1 NN--pointpoint DFT n=0

 Where Y(k) and Z(k) are the two N/N/22 point DFTs operating on even and odd samples respectively: N N −1 −1 2 2 = −nk + −k −nk Two N/N/22-- X ()k ∑ x1[]n WN WN ∑ x2 []n WN n=0 2 n=0 2 point = + −k DFTs Y()()k WN Z k 175175 DFT → FFT (k>N/(k>N/22))

N N −1 −1 2 2 = −nk + k −nk X ()k ∑ xe []n WN WN ∑ xo []n WN n=0 2 n=0 2 M

N N −1  N  −1  N  2 −n k +  N 2 −n k+   N   2  −k−  2  + = + 2 X k  ∑ xe []n WN WN ∑ xo []n WN  2  n=0 2 n=0 2

N 2π 2π N 2π −k − − j k − j − j k 2 = N N 2 = N − jπ = − −k WN e e e e WN

 N  2π 2π N 2π − k +  − j k − j − j k  2  = N 2 N 2 2 = N 2 = −k WN e e e WN 2 2

176176 DFT → FFT

N N −1 −1   2 2 + N = −nk − −k −nk X k  ∑ xe [n]WN WN ∑ xo [n]WN  2  n=0 2 n=0 2 = − −k Y ()()k WN Z k

177177 DFT → FFT

−  N  X ()()()k = Y k +W k Z k ; k = 0,K −1 N  2 

 N  −  N  X k +  = Y()()k −W k Z k ; k = 0,K −1  2  N  2 

 k Y(k) and WNN Z(k) only need to be calculated once and used for both equations.  Note: the calculation is reduced from 0 to NN--11 to 0 to (N/2(N/ 2 --11).).  If N=N=22LL, Y(k) and Z(k) can also be divided into N/N/44,, N/N/88,…,… point DFTs using the same process shown above.

178178 DFT → FFT

 The process continues until we reach 1 point DFTs N=N=11..

0 d = = 0 = X [k 0] ∑ x(n)W1 x(n) n=0

179179 Decimation--inin--timetime Radix--22 FFT (N=88)) Decimation--inin--timetime Radix--22 FFT (N=88)) Radix--22 DIT Basic Butterfly

a (complex) A (complex)

b (complex) B (complex)

WN (complex) FFT Implementation  To efficiently implement the FFT algorithm a few observations are made:

 Each stage has the same number of butterflies (number of butterflies = N/N/22,, N is number of points).

 The number of DFT groups per stage is equal to (N/(N/22stage ).).

 The difference between the upper and lower leg is equal to 22stagestage--11..

 The number of butterflies in the group is equal to 22stagestage--11..

 Total of 11//22NlogNlog 22N multiplications

183183 Twiddles  2πk   2πk  W k = cos   + j sin   Note that the twiddles N  N   N  are calculated off line and kept in a fixed table

Only the finest set of twiddles is needed. The rest are taken from the k = 2 k W N W N fine table using 2 k = 4 k W N W N 4 . .

. 184184 Bit reversal  During the first recursion, we split the signal to odd and even (according to the Least Significant Bit)  For every stage the LSB becomes the Most Significant Bit  The order of samples at input should be changed according to the bit reverse rule (reverse the “address bus”)

185185 Bit reversal

186186 Spectral analysis

187187 Signal windowing  y(n) ––discretediscrete time signal  We timetime--limitlimit the signal by multiplying it with a timtimee limited “window” function ––w(n),w(n), n=00,,11,…,Nn= ,…,N--11  x(n)=y(n)*w(n)  Example: Rectangle window = = x(n) y(n)wr (n) 1 n = 0,1,..., N −1 = y()n ⋅ 0 otherwise y()n n = 0,1,..., N −1 =   0 otherwise

188188 Frequency domain

x(n)=y(n) ..w(n)

189189 Rectangular window

Dirichlet kernel

“Linear phase” – To be revisited 190190 Dirichlet kernel

191191 Dirichlet kernel

 Maximum at

 Zeros at

 Width of main lobe is

 Ratio between main lobe and highest side lobe is

192192 Analysis of a pure cosine

y(θ ) * θ −θ θ 0 0

193193 Width of main lobe  Width of main lobe defines the frequency resolution.  Wide main lobe – poor resolution  Width is proportional to 1/N

194194 195195 Sampled amplitudes do not perfectly reflects true amplitudes

196196 Ratio between main and side lobes – “energy leak”  Side lobes of high amplitude signal may “mask” weaker signal if its side lobes are higher than the weak signal  The side lobes ratio does not change with N  E.g. Rectangle window may mask signals that are 1313dBdB weaker (not so good…)

197197 Triangle window

 Motivation –Higher ratio between main lobe and side lobes  Method

 In the frequency domain --Window with Dirichlet 22 response = 2727dBdB mainmain--sideside lobe ratio

 In the time domain --RectangleRectangle Window * Rectangle window = Triangle window

198198 Triangle window –N odd

Two rectangle windows – Length (N+1)/2 each

About half compared with rectangle window – Main lobe is about twice as wide

199199 Triangle window –N even Convolution between two rectangle windows – Length (N+1)/2 and N/2

About half compared with rectangle window – Main lobe is twice as wide

200200 Rectangle window

8π Width of main lobe N 201201 Raised cosine windows

 Motivation --ObtainObtain small side lobes  In the frequency domain – Linear combination of the Dirichletkernel and modulated Dirichlet kernels

202202 Raised cosine windows

Rectangle window

Rectangle window . Cosine

203203 Hann Window

204204 Hann Window

8π Width of main lobe N

205205 Hamming Window

206206 Hamming Window

8π Width of main lobe N

207207 Blackman Window

208208 Blackman Window

12 π Width of main lobe N

209209 Kaiser window

 A family of windows that depends on a parameter α.  α continuously tradeoffs between the width of main lobe and the main --toto --side lobes ratio  As α increases the mainmain--toto--sideside lobes ratio gets larger but main lobe width also increases

210210 Kaiser window

211211 Kaiser window

212212 Kaiser window

213213 Window shopping

214214 DFT --WindowWindow loss remedial Smooth datadata--taperingtapering windows cause information loss nearnear edges.

2 x N samples (input signal) Solution: sliding (overlapping) DFTs. DFT #1

• Attenuated inputs get next DFT #2 window’s full gain & leakage reduced. DFT #3 • Usually 50% or 75% overlap (depends on main lobe width).

Drawback: increased DFT AVERAGING total processing time.

215215 Example 1 – Main lobe width

For most applications - X axis is plotted in Hz up to ½ sampling rate  Fs=10001000;;  Ts=11/Fs;/Fs;  t=00:Ts::Ts:10231023*Ts;*Ts;  Freqs =( 00::512 )/)/ 512 **500 ;;  x=coscos((22*pi**pi*100100*t)+*t)+00..55**coscos((22*pi**pi*102102*t)*t) + 00..11**randnrandn(size(t));(size(t));  X=abs(X=abs(fftfft(x));(x));  plot(Freqs,plot(Freqs,2020*log*log1010(X((X(11::513513)));)));  xlabelxlabel('Freq('Freq (Hz)')  ylabelylabel('Amplitude('Amplitude (dB)')

216216 Example 1 – Main lobe width

60

50

40

30

20

AmplitudeAmplitude (dB) (dB) 10

0

-10

-20 0 50 100 150 200 250 300 350 400 450 500 Freq (Hz) 217217 Example 1a1a – Main lobe width

 Fs=Fs=10001000;;  Ts=Ts=11/Fs;/Fs;  t=t=00:Ts::Ts:10231023*Ts;*Ts;  Freqs=(Freqs=(00::512512)/)/512512**500500;;  x=cos( 22*pi* 100 *t)+ 00..55*cos( 22*pi* 102 *t)+ 00..11*randn(size(t));  x=x.*blackman(x=x.*blackman(10241024)';)';  X=abs(fft(x));  plot(Freqs,plot(Freqs,2020*log*log1010(X((X(11::513513)));)));  xlabel('Freq (Hz)')  ylabel('Amplitude (dB)')

218218 Example 1a1a – Main lobe width

50

40

30

20

10 AmplitudeAmplitude (dB) (dB)

0

-10

-20 0 50 100 150 200 250 300 350 400 450 500 Freq (Hz)

219219 Example 2 –Main --toto--SideSide lobes ratio  Fs=10001000;;  Ts=11/Fs;/Fs;  t=00:Ts::Ts:10231023*Ts;*Ts;  Freqs=(Freqs=(00::512512)/)/512512**500500;;  x=cos( 22*pi* 100 *t) + 00..002 *cos( 22*pi* 150 *t) + 00..001001*randn(size(t));*randn(size(t));  X=abs(fft(x));  plot(Freqs,plot(Freqs,2020*log*log1010(X((X(11::513513)));)));  xlabel('Freq (Hz)')  ylabel('Amplitude (dB)')

220220 Example 2 –Main --toto--SideSide lobes ratio

60

50

40

30

20 Amplitude (dB)

10

0

-10 0 50 100 150 200 250 300 350 400 450 500 Freq (Hz)

221221 Example 2a2a –Main --toto--SideSide lobes ratio  Fs=Fs=10001000;;  Ts=Ts=11/Fs;/Fs;  t=t=00:Ts::Ts:10231023*Ts;*Ts;  Freqs=(Freqs=(00::512512)/)/512512**500500;;  x=cos( 22*pi* 100 *t) + 00..002 *cos( 22*pi* 150 *t) + 00..001001*randn(size(t));*randn(size(t));  x=x.*blackman(x=x.*blackman(10241024)';)';  X=abs(fft(x));  plot(Freqs,plot(Freqs,2020*log*log1010(X((X(11::513513)));)));  xlabel('Freq (Hz)')  ylabel('Amplitude (dB)')

222222 Example 2a2a –Main --toto--SideSide lobes ratio

50

0 Amplitude (dB) -50

-100 0 50 100 150 200 250 300 350 400 450 500 Freq (Hz) 223223 Filter design

224224 RCSR – Real coefficients, Causal, Stable, Rational)

Continuous time filter

225225 Region of Convergence Re(s) > −α jω ROC pole x -α σ

226226 Poles and Zeros

s −1 X (s) = Re (s) > −1 (s + 2)( s +1) jω complex plane ROC poles

x x o σ -2 -1 1 zero

227227 For distinct poles

For non trivial systems, the impulse response is infinite in time

228228 Discrete time

229229 Example: Region of Convergence

∞ ∞ | X (z) |= ∑ x(n)z −n = ∑| x(n) || z |−n < ∞ n=−∞ n=−∞ Im ROC is an annual ring centered on the origin.

r < < RI | z | RO Re = = jθ < < ROC {z re | RI r RO} Stable Systems

 A stable system requires that its Fourier transform is uniformly convergent.

Im  Fourier transform is to evaluate z- transform on a unit circle.  A stable system requires the ROC of z- 1 transform to include the unit circle.

Re Causal Signal

n ∞ = − n 1 x[n] a u[n] X (z) = ()az 1 = z > a ∑ − −1 x[n] 1 a a 2 a3 a4 a5 … n=0 1 az

z X (z) = z > a n z − a unit circle zero pole

o x a 1

ROC complex z-plane 232232 AntiAnti--causalcausal Signal

n ∞ −1 = − − − − − x[n] a u[ n ]1 X (z) = − ∑ anu(−n − )1 z n = − ∑ an z n n=−∞ n=−∞ ∞ ∞ n n = −∑()()a−1z =1− ∑ a−1z n=1 n=0 1 =1− z < a 1− a−1z z unit circle X (z) = z < a z − a zero pole ROC o x 1 a

complex z-plane 233233 For distinct poles

Stable if

Note: The C-coefficients part of the unit sample response is finite in time. The part due to poles is infinite.

234234 FIR and IIR systems

 A discrete system is said to be an FIR system if its impulse response has zero--valuedvalued samples for nn > M > 00  Integer number M is called the order of the impulse response  IIR system is a discrete system with an infinite impulse response  FIR = Finite Impulse Response IIR = Infinite Impulse Response 235235 Representations of discrete time systems

Z-domain

236236 Difference equation

− − Y(z) b + b z 1 +... + b z q H z ()z = = 0 1 q + −1 + + − p X ()z 1 a1z ... a p z ⋅ + −1 + + − p = ⋅ + −1 + + −q Y ()z []1 a1z ... a p z X ()z []b0 b1z ... bq z

Recall that x(n) X(z) x(n-1)z-1X(z)

+ − + + − = y(n) a1 y(n 1) ... a p y(n p) = + − + + − b0 x()()()n b1x n 1 ... bq x n q

237237 Difference equation building blocks

= − − − − − + y(n) a1 y(n 1) ... a p y(n p) + + − + + − b0 x()()()n b1x n 1 ... bq x n q

Delay

Multiplier

Adder

238238 FIR

239239 IIR

240240 Filter types

241241 Specifications of LPF Transition band

Pass band Stop band

242242 Pass band

 Nominal gain is 11  Pass band ripple  In dB

Approximation

243243 Transition band

 No specific requirements  Response is expected to be monotonic  Important: we shall see that the complexity of the filter depends heavily on the width of the transition band

244244 Stop band attenuation (ripple)

245245 arctan2 –arctangent function for all four quadrants

arctan(y/x) is limited to first two quadrants (sign ambiguity)

246246 of RCSR systems

247247 Continuity

For RCSR systems is continuous on the unit circle.

is continuous and the phase is continuous

except for two cases:

1. Function crosses the negative real line

2. Zero amplitude

248248 Case 1 -- Function crosses the negative real line

2π phase jump

249249 Example – y(n)=x(n--88))--x(nx(n--1010))

2 4

1.8 3 1.6 2 1.4 1 1.2

1 0 Phase Amplitude 0.8 -1 0.6 -2 0.4 -3 0.2

0 -4 0 0.5 1 1.5 2 2.5 3 3.5 0 0.5 1 1.5 2 2.5 3 3.5 Freq Freq

2π jumps 250250 can be zero only for a finite number of points

may be zero only at a finite number of points ( מונה ) The numerator

251251 Case 2 -- Zero amplitude

Phase undefined at z=0

(Algebra) H(z) = 0 only for a finite number of points – order of מונה numerator ( ) 252252 Example –y(n)= x(n)+x(n--11)+…+x(n)+…+x(n--99))

10 1.5

9 1

8 0.5

7 0 6 -0.5 5

Phase -1 Amplitude 4 -1.5 3

-2 2

1 -2.5

0 -3 0 0.5 1 1.5 2 2.5 3 3.5 0 0.5 1 1.5 2 2.5 3 3.5 Freq Freq

Phase jump is due to sign (+/-) change π jumps 253253 Phase jumps can be either π or 2π

 Case 1 – always 2π  Case 2 --is zero if has a zero with multiplicity m on the unit circle at

254254 Case 2 --continuedcontinued

Continuous phase Continuous near π jump if m odd

255255 Continuous phase representation

 We shall allow phase to be any real number and not limited to [[––ππ,,π)π) , to overcome 22ππ jumps  We shall define an Amplitude function instead of absolute value. The new Amplitude function will allow negative values, to overcome ππ jumps

Amplitude – real (may be Continuous phase negative) function 256256 Conversion between Absolute/Phase to Amplitude/Continuous --PhasePhase  Start at θ==––π and move toward θ=π  At each phase discontinuity:

 Case 1 ––PhasePhase --Add/SubtractAdd/Subtract 22ππ

 Case 2 –– Phase -- Add/Subtract π,π, Multiply amplitude by --11

257257 Example

258258 Formal math.

Discontinuity points

259259

At the discontinuity points define as limit Remarks

 Representation is not unique

 Add/Subtract 22ππ

 Add/Subtract ππ and multiply amplitude by --11

 In order to be unique, force

260260 Linear phase

22..261261 Delay (number of samples --integer)integer)

Pure delay X(n) y(n)=x(n-L) No distortion

Linear phase

262262 Delayed sinc L=5

263263 Non integer delay

X(n) ?

Y (θ )= X (θ )⋅e− jθ (L+δ )

Integer fraction

264264 Non integer delay

1 m = n − L for δ = 0, sinc ()n − m − L =  0 otherwise 265265 Non integer delay

Assume signal is sampled at T=1 ∞ y()()n = ∑ x m sinc []t − m m=−∞ t=n−L−δ

x(t) x(t − L −δ )

Ideal sinc Continuous Sample x(n) reconstruction time delay y(n)

266266 Delayed sinc 4..54 5 samples

267267 Linear phase filters Continuous phase representation

Phase delay (Unit is samples)

Linear phase filter has a constant phase delay

Note: The phase properties are relevant mainly to the pass band of the filter.

268268 Generalized Linear phase

During the last section we discussed Linear Phase systems with the form − θτ H (θ )= e j p

We shall now try to generalize this to systems with initial non zero phase

? − H (θ )=e jφ0 jθτ g

For RCSR systems, the phase is anti-symmetric (phase at DC is zero) −  e jφ0 jθτ g θ > 0 ?  − − H ()θ =e jφ0 jθτ g θ < 0  0 θ = 0  269269 We relax the requirements to regions where the signal exists −  jφ0 jθτ g θ < θ < θ e 1 2  − − θ jφ0 jθτ g θ θ θ H ()= e − 2 < < − 1   0 otherwise

Typical case for GLP is a modulated signal

Envelope carrier

we assume that the signal bandwidth is within θ < θ < θ 1 2

270270 The modulated signal is within filter limits

271271 Modulation property x(n)↔ X f (θ ) 1 x()()n ⋅ cos θ ⋅ n ↔ []X f ()()θ −θ + X f θ +θ c 2 c c

The output

1 Y f (θ )= H (θ )[X f (θ −θ )+ X f (θ +θ )]= 2 c c Positive frequencies negative frequencies

1 jφ − jθτ 1 − jφ − jθτ = X f ()θ −θ ⋅ e 0 g + X f ()θ +θ ⋅ e 0 g 2 c 2 c

272272 1 jφ − jθτ 1 − jφ − jθτ Y f ()θ = X f ()θ −θ ⋅ e 0 g + X f ()θ +θ ⋅ e 0 g = 2 c 2 c

1 jφ + jθ τ − jθ τ − jθτ = X f ()θ −θ ⋅ e 0 c g c g g 2 c

1 − jφ + jθ τ − jθ τ − jθτ + X f ()θ +θ ⋅ e 0 c g c g g = 2 c

1 − j()θ −θ τ jφ − jθ τ = f θ −θ ⋅ c g ⋅ 0 c g X ()c e e 2 Constants

1 − j()θ +θ τ − jφ + jθ τ + X f ()θ +θ ⋅ e c g ⋅ e 0 c g 2 c

273273 Linear phase delay x(n)↔ X f (θ ) of envelope define − θτ v()()n ↔ X f θ ⋅ e j g Delayed cosine

1 jφ − jθ τ − jφ + jθ τ cos [θ ⋅ ()n −τ +φ ]↔ [e 0 c g ⋅δ ()()θ −θ + e 0 c g ⋅δ θ +θ ] c g 0 2 c c Convolution in frequency ⋅ ⋅ − + ↔ v(n) cos (θc (n τ g ) φ0 )

1 − j()θ −θ τ jφ − jθ τ X f ()θ −θ ⋅ e c g ⋅ e 0 c g + 2 c Envelope is delayed by τg 1 − j()θ +θ τ − jφ + jθ τ + X f ()θ +θ e c g ⋅ e 0 c g 2 c

274274 The constant phase affects the carrier but not the envelope

where

275275 GLP --GeneralizedGeneralized linear phase

Group delay

For modulated signals -the envelope is delayed by [Group delay] samples

276276 Group delay is L or L+00..55

Is periodic

Real Real

Must be integer

277277 Group delay is L/L+00..55

278278 h(n) is real

Real

279279 Four types of GLP filters

280280 The impulse response of Types I,II is symmetric

281281 The impulse response of Types I,II is symmetric

Type I

Type II

Casual GLP filters may only be FIR 282282 The impulse response of Types III,IV is anti symmetric

Type III

Type IV

Casual GLP filters may only be FIR 283283 Minimum phase

Im(z)

Re(z)

284284 Same absolute value

285285 Minimum--PhasePhase System

 The new system has same absolute value, but with mirrored zero  Theorem: The system with zero inside unit circle has lower group delay  A system with all poles and zeros inside the unit circle is called “minimum--phase”.phase”. Both the system function and the inverse is causal and stable  A system with all poles inside the unit circle and zeros outside is called “maximum--phase”.phase”. No inverse system.  Given an RCSR filter, we may build a minimum phase RCSR filter with the same absolute value.

286286 AllAll--PassPass filter Using mirrored pole and zero

In general

287287 Minimum--phasephase and All--passAll pass decomposition  Zero in unit circle MP  Zero outside

 Add mirrored pole Zero and pole to AP

 Add mirrored zero MP

288288 Example

 Consider the following system 1 + 3z−1 H z = 1 () 1 1 + z−1 2  One pole inside the unit circle:

 Make part of minimumminimum--phasephase system  One zero outside the unit circle:

 Add an allall--passpass system to reflect this zero inside the unit circlecircle

1 −1 −1 1 − z 1 + 3z 1  −1 1 1  −1 1 3 H ()z = = 3 z +  = 3 z +  1 1 1 3 1 3 1 1 + z−1 1 + z−1   1 + z−1   1 − z−1 2 2 2 3  1  1   1 − z−1  z−1 +  H z 3 3  3  H z H z 1 ()= = min ()()ap  1 −  1 −   1 + z 1 1 − z 1   2  3 

289289 Frequency--ResponseResponse Compensation  In some applications a signal is distorted by an LTI system  Could filter with inverse filter to recover input signal

 Would work only with minimumminimum--phasephase systems  Make use of minimumminimum--phasephase all--passall pass decomposition

 Invert minimum phase part  Assume a distorting system H dd(z)(z)  Decompose it into H z = H z H z d ( ) ,d min ( ) ,d ap ( )  Define compensating system as 1 H ()z = c H z ,d min ()  Cascade of the distorting system and compensating system 1 G()()()()()z = H z H z = H z H z = H ()z c d ,d min ,d ap H z ,d ap ,d min ()

290290 FIR Filters

N – filter order Total of N+1 non-zero coefficients

291291 = + − + + − y(n) h0 x(n) h1x(n 1) ... hM x(n M )

Direct implementation

Dual implementation

292292 Example 1:1: Average of two samples

1/2 h(0) = 1 ,h(1) = 1 ; 2 2 0 1 y(n) = h(0)x(n) + h(1)x(n −1) = 1 + 1 − y(n) 2 x(n) 2 x(n 1)

293293 Example 1:1: Average

= 1 = 1 h(0) 2 ,h(1) 2 ; Equation: = 1 + − y(n) 2 (x(n) x(n 1))

Transfer function: = 1 + 1 −1 H (z) 2 2 z

θ − θ j θ − j θ − j θ −i θ j = 1 + j = 1 2 + 2 2 = θ 2 H (e ) 2 (1 e ) 2 (e e )e cos (2 )e

294294 Example 2:2: Difference of two samples

1 h(0) = 1,h(1) = −1; y(n) = h(0)x(n) + h(1)x(n −1) y(n) = x(n) − x(n −1) −1

295295 Example 2:2: Differentiator

Equation: y(n) = x(n) − x(n −1)

h(0) =1,h(1) = −1;

− Transfer function: H (z) =1− z 1

θ − θ j θ − j θ − j θ − j θ + j π j = − j = 2 − 2 2 = θ 2 2 H (e ) 1 e (e e )e 2sin (2 )e

296296 Type I FIR LinearLinear--PhasePhase System

 Even order  Symmetric  Zero initial phase

297297 Frequency response –type I

298298 Frequency response –type I

Linear phase amplitude

299299 Type I

Symmetric impulse response Amplitude symmetric with period is 22ππ

300300 Type II FIR LinearLinear--PhasePhase System

 Odd order  Symmetric  Zero initial phase

301301 Frequency response –type II

302302 Frequency response –type II

Linear phase amplitude

Cannot be HP

Relations between h(n) and g(n) may be found in the book

303303 Type II

Symmetric impulse response Amplitude symmetric with period is 44ππ

304304 Type III FIR LinearLinear--PhasePhase System

Even order Anti-symmetric Initial phase

305305 Frequency response –type III

Linear phase amplitude

Mainly used for Hilbert filters / Differentiators 306306 Type III

Anti symmetric impulse response Amplitude anti symmetric, periodperiod is 22ππ

307307 Type IV FIR LinearLinear--PhasePhase System

Odd order Anti-symmetric Initial phase

308308 Frequency response –type IV

Linear phase amplitude

Mainly used for Hilbert filters / Differentiators 309309 Type IV

Anti symmetric impulse response Amplitude anti symmetric, periodperiod is 44ππ

310310 Summary of the four types

311311 Summary

Less constraints when using types I,IV 312312 Location of Zeros for Symmetric Cases

So if z 0 is a zero 1/z 0 is also a zero of the system

If h[n] is real and z 0 is a zero z 0* is also a zero

313313 Typical Zero Locations

314314 Linear phase Low pass zeros map

22..315315 Relation of FIR Linear Phase to Minimum--PhasePhase  In general a linearlinear--phasephase FIR system is not minimuminimumm--phasephase  We can always write a linearlinear--phasephase FIR system as

H(z)= Hmin (z)Huc (z)Hmax (z)  Where

−1 −Mi Hmax (z)= Hmin (z )z

 And Mii is the number of zeros  HHminmin (z) covers all zeros inside the unit circle  HHucuc (z) covers all zeros on the unit circle  HHmax (z) covers all zeros outside the unit circle

316316 FIR filter design

 IRT --ImpulseImpulse response truncation  IRT 2 ––WindowsWindows  EquiEqui--rippleripple filters

317317 IRT

 Given filter specifications, select filter type and order (group delay is half of the order)  Specify ideal filter response (including linear phase)  Perform inverse DTFT  Truncate response  Verify design

318318 Band pass filter –Type I,II

319319 Special cases

HP only for type I 320320 Example

321321 Example

322322 Déjà vu

 Both examples presented the familiar Gibbs ripple due to limitation in time  We met that before when we discussed spectral analysis using a rectangle windows  Soon we shall try other windows

323323 Differentiator

Continuous time

Limited bandwidth discrete time approximation

Ideal filter

We shall see that type III will not provide good results due to its zero at π 324324 Differentiator

325325 Differentiator

326326 Differentiator

327327 Hilbert filter

Very useful with bandpass applications

For example, ultrasound signal processing

Benefits:

Mathematical basis for representing bandpass signals

Easy determination for signal envelope

Half bandwidth --MayMay reduce ADC sampling rates

328328 Hilbert filter 1 xˆ()()t = x t ∗ π Filter impulse response is 11//ππtt t ∞ Frequency domain Hilbert transfer 1 x()τ function: = dτ ∫ − π −∞t τ

− j, when f > 0   +90 H ()()f = − j sgn f = + j, when f < 0   f  0, when f = 0  -90 The signal and its Hilbert transform are orthogonal ∞ Phase response ∫ x()()t xˆ t dt = 0 −∞ 329329 Bandpass Signals

 Bandpass signals

 Let z(t) be a bandpass signal centered around some ff00

 z(t) can be expressed as = π − π z(t) x(t)cos (2 fot) y(t)sin (2 fot)

 In this expression, x(t) and y(t) are lowpass. z(t) can be written as = π +θ z(t) a(t)cos (2 fot (t))  where a ()()() t = + x 2 t + y 2 t  and θ (t)= sin −1(y(t)/ x(t))

330330 Analytic signal  Upper graph shows an FFT of the original signal, x(t).

 Analytic signal in the frequency domain (Single Side Band):

x+ (t)= x(t)+ jxˆ(t)

2Z(f ), when f > 0   Z+ ()()()f = Z f + j[]− jsgn f Z()f =  Z()0 , when f = 0     ,0 when f < 0 

331331 Pre--envelopeenvelope

= π +θ  Baseband signal: g(t) m(t)cos (2 fct )

G(f)

G+(f)

332332 Complex Envelope Summary

 Complex/pre envelope are related

− j2πf t G+(f) g˜ ( t) = g+(t)e c or Gˆ ( f ) j2πf t g+(t) = g˜ ()t e c

333333 Signal

334334 Signal + Hilbert

335335 Envelope

336336 Discrete time Hilbert filter

Continuous time (almost “All Pass”)

Discrete time approximation

337337 Hilbert filter impulse response

338338 Hilbert filter

339339 Hilbert filter

340340 L22 Optimality of IRT

Desired Actual

FIR – h(n) is non -zero for n= 0,..,N Time domain (Parseval)

Independent of FIR Optimal when  hd(n)=h(n) IRT 341341 L22 Optimality of IRT

 The IRT is optimal in L22, mean square error  The integral properties of L22 results in Gibbs phenomena – 10% error with smaller and small width as N increases  We shall learn two solutions:

 Windows to reduce ripple

 Min max equiequi--rippleripple filters

342342 Example

343343 Windows

 The convolution between the Dirichlet kernel and the ideal filter response results in the Gibbs ripple  We already know other windows with better performance in the frequency domain  Instead of simple truncation, use Window

 Window length will be filter order

 All windows we know are symmetric, will keep original symmetric / antianti--symmetricsymmetric properties

344344 Windowing in Frequency Domain

π θ 1 λ θ −λ H ()e j = H ()e j W ()e j()dλ π ∫ d 2 −π

345345 Windows

 The width of window’s main lobe equals the width of the transition band. Getting smaller with N  Ripple is the same for pass and stop band  The ripple is a depends on the window type and its side lobes.  Unlike DFT, relation is indirect to window’s side lobes (there is a convolution here).  Ripple figures are different from DFT.

346346 Windowed IRT

 Given filter specifications, select filter type and order (group delay is half of the order)  Specify ideal filter response (including linear phase)  Perform inverse DTFT  Truncate h(n) by a = window w(n) h(n) hd (n)w(n)  Verify design

347347 Effect of windowing

Gibbs

348348 Example:FIR Filter Design by Windowing Method jω 20*log 10 H( e ) N=55 [dB]

Bartlett Window Rectangular Window Hamming Window ω 349349 Example:FIR Filter Design by Windowing Method

jω 20*log 10 H( e ) [dB] Rectangular Window

Kaiser Window: alfa=3

Kaiser Window: alfa=10 Kaiser Window: alfa=15

Kaiser Window: alfa=30

ω 350350  Matlab code

close all; clear all;

fc = 8000/44100; % cut-off frequency N = 133; % number of taps n = -((N-1)/2):((N-1)/2); n = n+(n==0)*eps; % avoiding division by zero

[h] = sin(n*2*pi*fc)./(n*pi); % generate sequence of ideal coefficients [w] = 0.54 + 0.46*cos(2*pi*n/N); % generate window function d = h.*w; % window the ideal coefficients

[g,f] = freqz(d,1,512,44100); % transform into frequency domain for plotting

figure(1) plot(f,20*log10(abs(g))); % plot transfer function axis([0 2*10^4 -70 10]);

figure(2); stem(d); % plot coefficient values xlabel('Coefficient number'); ylabel ('Value'); title('Truncated Impulse Response');

figure(3) freqz(d,1,512,44100); % use freqz to plot magnitude and phase response axis([0 2*10^4 -70 10]); 351351 Truncated Impulse Response Window 0.4 0.3

Method 0.2 Value 0.1

0

-0.1 0 20 40 60 80 100 120 140 Coefficient number

0

-20

-40

Magnitude (dB) Magnitude -60

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Frequency (Hz) 4 x 10 0

-2000

-4000 Phase (degrees) -6000 0 0.5 1 1.5 2 Frequency (Hz) 4 x 10

22..352352 Windows

Figures are different compared to DFT

22..353353 Empirical selection of α an N for Kaiser Window Define A

22..354354 Example: Kaiser Window Design of a Lowpass Filter ω = π ω = π δ = δ =  Specifications p 0.4 , p 0.6 , 1 0.01, 2 0.001  Window design methods assume δ1 = δ2 = 0.001  Determine cutcut--offoff frequency

 Due to the symmetry we can choose it to be ωc = 0.5π  Compute ∆ω = ω − ω = 0.2π = − δ = s p A 20log10 60  And Kaiser window parameters α = 5.653 M = 37  Then the impulse response is given as

  2  n − 18.5  I 5.653 1 −     0  18.5  h n = sin[]0.5π n − 18.5   []  ()  0 ≤ n ≤ M  π()n − 18.5 I ()5.653  0  0 else

355355 Approximation Error

356356 Min--MaxMax FIR filter design Parks--McClellan algorithm Remez exchange

jθ D(e ) desired frequency response θ H (e j ) actual frequency response

357357 L2 (RMS of yellow area) vs. Minmax metrics

D(θ ) θ θ H () p

Minmax

θ π

θ S

358358 ComputerComputer--AidedAided Design of Digital Filters  Objective --DetermineDetermine iteratively the coefficients of H((zz), minimizing the difference between D ( e jθ ) and H ( e jθ ) over closed subintervals of 0 ≤ θ ≤ π  This difference usually specified as a weighted error function E(θ ) = W (e jθ )[ H (e jθ ) − D(e jθ )] where W ( e j θ ) is useruser--specifiedspecified weighting function. Regions with relatively higher weighting values will result in smaller relative error.

359359 Weighting function

The higher (relative) weighing function will result in (relative) lower ripple

360360 ComputerComputer--AidedAided Design of Digital Filters  Chebyshev or minimax criterion: Minimizes the peak absolute value of the weighted error: ε = max E(θ ) θ∈Θ

where Θ is a set of disjoint frequency bands in the range 0 ≤ θ ≤ π , on which D ( e j θ ) is defined  For example, for a lowpassfilter design, Θ θ θ π is the disjoint union of [ 0 , p ] and [ s , ]

361361 Design of Equiripple LinearLinear--PhasePhase FIR Filters  The linearlinear--phasephase FIR filter obtained by minimizing the peak absolute value of

ε = max E(θ ) θ∈Θ

is usually called the equiripple FIR filter  After ε is minimized, the weighted error function E((θ) exhibits an equiripple behavior in the frequency range Θ

362362 Design of Equiripple LinearLinear--PhasePhase FIR Filters

 The general form of frequency response of a causal linearlinear--phasephase FIR filter of order N:

363363 Optimization problem

364364 Alternation Theorem

Sufficient and Necessary condition to optimal solution. The function

Has K+2 alternate extreme points: Minimum (-δ), Maximum (+ δ), Minimum (-δ), Maximum (+ δ), etc.

365365 Equiripple example

+δ 1 1 −δ 1 1 K = 7

δ 2 ω −δ 0 ω ω π 2 p s

δ 2 0 ω −δ 2 ω ω p s K + 2 = 9 B1 B 2 extremal points 366366 Alternation Theorem

K+2 alternate extreme points: Minimum (-δ), Maximum (+ δ), Minimum (-δ), Maximum (+ δ), etc.

367367 Iterative approximation

1. Guess initial extreme point set

θ 2. We have K+2 linear equations, one for each i and K+2 δ unknowns g k and

δ θ 3. After solving for g k and , sample in the left-hand side of the equation and approximate the extreme point. If the extreme points are close to the optimality condition – stop. Otherwise

4. Update

and goto 2

368368 Remez Exchange Algorithm

369369 Equiripple FIR Design Using MATLAB  Example --DesignDesign a linear--phaselinear phase FIR bandpass filter of order 26 with a passband from 0..30 3 to 0..50 5,, and stopbands from 0 to 0..250 25 and from 00..5555 to 1  The pertinent input data here are N = 26 fpts = [[00 0..2525 0..33 0..55 0..5555 1]] mag = [[00 0 1 1 0 0]] wt = [[11 1 1]] 370370  Computed gain response shown below = = where A p 1 dB, A s 18 . 7 dB

N = 26, weight ratio = 1 0

-20

Gain, dB Gain, -40

-60 0 0.2 0.4 0.6 0.8 1 ω/π 371371  We redesign the filter with order increased to 110  Computed gain response shown below = = where A p 0 . 024 dB, A s 51 . 2 dB  Note: Increase in N = 110, weight ratio = 1 order improves 0 gain response at the -20 expense of increased -40 Gain, dB Gain, computational -60

complexity -80 0 0.2 0.4 0.6 0.8 1 372372 ω/π  As can be improved at the expenses of a

larger A p by decreasing the relative passbad weight ratio W (θ ) N = 110, weight ratio = 1/10  Gain response of 0 bandpass filter of -20 order 110 obtained with a weight vector -40 Gain, dB Gain, [[1 0 ..1 1 ]] -60  = Now A p 0 . 076 dB, -80 0 0.2 0.4 0.6 0.8 1  = dB ω π As 60 .86 /

Note: For Equiripple filters, higher N results in smaller ripple

373373  Plots of absolute error for 1st1st design  Absolute error has

same peak value in N = 26, weight ratio = 1 0.2 all bands 0.1

0

Absolute Error Absolute -0.1

-0.2 0 0.2 0.4 0.6 0.8 1 ω/π

374374 Absolute error in 2nd design is Absolute error in passband of uniform 3rd design is 10 times the error in the stopband

x 10 -3 N = 110, weight ratio = 1 N = 110, weight ratio = 1/10 4 0.01

2 0.005

0 0

Absolute Error Absolute -2 -0.005

-4 -0.01 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 ω/π ω/π

375375 Estimating filter order N

Equi-ripple filter order can be estimated by

Transition band (Hz) Sampling Rate (Hz)

376376 IIR Filter Design

Pros  lowlow--orderorder filters can have sharp frequency responseresponse  low computational cost  Low phase delay

Cons  Design more difficult  Stability not trivial as FIR  Phase response not easily controlled (e.g. no casual linearlinear--phasephase IIR filters)  Feedback --coefficientcoefficient sensitivity, quantization nonoise,ise, etc. ccanan be a problem

377377 IIR filters Rational transfer function :  B(z) b z N + b z N −1 + ... + b b + b z −1 + ... + b z − N H (z) = = 0 1 N = 0 1 N N + N −1 + + + −1 + + −N A(z) z a1z ... aN 1 a1z ... a N z N poles (zeros of A(z)) , N zeros (zeros of B(z))  infinitely long impulse response  stable iffiff poles lie inside the unit circle  corresponds to difference equation + − + + − = + − + + − y[k] a1.y[k 1] ... aN .y[k N ] b0 .u[k] b1.u[k 1] ... bN .u[k N ] y[k] = b .u[k] + b .u[k −1] + ... + b .u[k − N ]− a .y[k −1] − ... − a .y[k − N ] 10 44441 44 2444N444 3141 4444 244N 444 3 `MA ' `AR ' `ARMA’ (autoregressive(autoregressive--movingmoving average)

378378 IIR Filter design

 We shall study IIR design by conversion of analog filters to digital filters  Steps

 Design specs in the digital domain

 Convert specs to analog domain

 Design analog filter

 Convert analog filter to digital filter

 Verify design

379379 Analog filter to digital filter conversion  Impulse invariance  Step invariance  Bilinear transform

380380 Popular analog filters

Butterworth All pole No ripples Maximally flat Chebyshev II All pole Pass band ripples Sharper than Butterworth Chebyshev IIII Both poles and zeros Stop band ripples Sharper than Butterworth Elliptic Both poles and zeros Both pass and stop band ripple Sharper than Chebyshev Bessel All pole No ripples Close to linear phase 381381 Analog Filter frequency response

Trade off between low ripples and sharp transition band 382382 Time domain response

Trade off between low overshoot and sharp transition band

383383 Butterworth Filters

 The amplitude | H(j ωω)|)| of an nnthth order is given by

 Observations:  The DC gain | H(j 00))| is unity

 ωω ωω ωω At == cc the gain is | H(H(jj cc))|=|=00..707707 or --33 dBdB  Monotonic  Asymptotic 2020nn dB/decade

 ωω cc is called the halfhalf--powerpower frequency , or the 3 dBdB-- cutoff frequency

384384 Normalized Butterworth Filters

 We prefer to work with a normalized filter whose cutoff ωω frequency is 1 rad /sec ( cc ==11),), i.e.

 Amplitude response of a Butterworth filter is maximally flat at DC (the first 22nn--11 derivatives of | H(j ωω))| are zero at ωω==00))  The filter gain is 1 ((00 dB) at ωω==00 and 00..707707 ((--33 dB) at ωω==11forfor all n  For large n, the amplitude response approaches the ideal characteristic

385385 Normalized Butterworth Filters

386386 Normalized Butterworth Filters

387387 Stop band Low--PassPass Butterworth Filter Attenuation

388388 Poles location

Butterworth transfer function

Define h(s)

h(s) has 2n poles, evenly spaced on the unit circle (Note: Analog filter – unit circle has nothing to do with stability)

389389 n - even k=0,1,..,2n-1 n - odd

Pk=n =-1 for odd n

We assign H(s) with the stable poles (left to imaginary axis) H(-s) is assigned with non stable poles

390390 n=1 Butterworth Filters A first order continuous time filter frequency response is given by 1 H(ω) = a > 0 jω + a jω complex plane

ROC pole x -a σ

391391 n=2 2 ± j 2

1

0.8 X 0.6

0.4

0.2

0

-0.2

-0.4

-0.6 X -0.8

-1 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 392392 n=3 h(s)=

Left side poles

393393 n = 3

 H(s) only uses the n poles in the left half plane for stability.

394394 Butterworth Filter |H(s)| for n=4

H(s) = 1/( s 4 + 2.6131s3 + 3.4142s2 + 2.6131s + 1)

395395 n=10

396396 Selection of filter order

ω Select c and n to comply with specs.

397397 Pass band

Stop band

Solution

where

ω Select c to comply with pass band or stop band inequalities 398398 Normalized Butterworth table

For larger order – search literature

399399 Normalized Butterworth poles

For larger order – search literature

400400 Chebyshev polynomials

Define Nth order Chebyshev polynomial

Continuous function

Example

= ⋅ = 2 − = T2 (x) cos (2 arccos (x)) 2cos (arccos (x)) 1 = 2x2 −1 401401 402402 Recursive formula

For |x|< 1 polynomial has equi -ripples between -1 and + 1 Number of ripples increases with N  For |x|>1 |T N(x)| monotonically increases with |x|  Even/Odd N – TN(x) has only even/Odd powers of x  |T N(0)|=1 for even N  TN(0)=0 for odd N  |T N(-,1+1)|=1

403403 404404 405405 Chebyshev type I (Pass band ripple)

ε- parameter Large ε results in larger ripples and faster roll off

Pass-band properties

406406 407407 20N dB/Decade

408408 Poles layout (ellipse)

409409 Chebyshev type II (stop band ripple)

Note: Frequency axis reversed

410410 411411 Elliptic filter (Pass and stop band ripple)

412412 4th order elliptic filter

413413 Bessel filters (linear phase approximation)

θ (0) H ()s = N N θ ω N ()s 0 N ()2N − n ! θ ()s = sn N ∑ N −n ⋅ ⋅ − n=0 2 n!(N n)!

Pole layout

414414 Actual 3rd order Bessel low pass 415415 Analog Filter transforms

 So far we studied normalized low pass ω filters with cc==11  We shall refer to a normalized low pass filter as the prototype filter  In order to design non--normalizednormalized LPF or other types (HPF,BPF, etc.) we use filter transforms

416416 s s ← ω 0

Normalized low pass ω =1 ω = ω to low pass with cutoff at 0

ω s ← 0 s

Normalized low pass ω =1 ω = ω to high pass with cutoff at 0 417417 s2 +ω ω s ← H L + ω −ω s ()H L

Normalized low pass ω =1 ω ω to band pass with cutoffs at L , H

s + (ω −ω ) s ← H L 2 +ω ω s H L

Normalized low pass ω =1 ω ω to band stop with cutoffs at L , H

418418 Example –design a 3rdrd order Butterworth LPF at 1KHz1KHz

Prototype

LP  LP

419419 Example –Design a 5thth order elliptic 11KHzKHz high--passpass 1dB,1dB,--6060dB filter with Matlab >> [b,a] = ellip(5,1,60,1000,'high','s'); >> [h w]=freqs(b,a,1000); >> semilogx(w,20*log10(abs(h))),grid,xlabel('Freq (Hz)'),ylabel('Gain (dB)')

0

-10

-20

-30

-40

-50 Gain Gain (dB) -60

-70

-80

-90

-100 10 2 10 3 10 4 Freq (Hz) 420420 IIR Filter design Analog domain Digital domain

Specifications

Specifications Specifications

Design

Analog Filter Digital Filter 421421 Analog filter to Digital transforms  Given a RCSR analog filter  We would like to transform the analog filter to a “similar” digital filter  Digital filter requirements:

 Similar frequencyfrequency--gaingain properties

 RCSR

 Same order

422422 Impulse invariance

 Continuous time (CT) and discrete time (DT) LTI systems are characterized by their impulse response  Filter response is the convolution between the impulse response and the input signal  Idea – Given a CT filter with impulse response h(t), use a DT filter with impuse response h(h(nTnT))  mapping: HLL(s) -->> H(z) 423423 Impulse invariance The digital filter unit sample response is sampling of the analog filter impulse response

Given analog filter find its impulse response by Inverse Sample impulse response Calculate digital filter using Z transform

In short 424424 T is needed for similar DC gain

22..425425 Example –single pole LP

426426 The stable analog pole at -α Was transformed to a stable digital pole at (note 2π period)

jω Im(z) 3π/Τ

aliasing π/Τ x σ x Re(z) -α −π/Τ

unit circle 427427  High pass --TheThe analog filter impulse response may include impulses if numerator order equals or larger than denominator order  How to sample the analog impulse ??

428428 In general using fraction decomposition and the previous example

429429 → = ha (t) h(n) Tha (nT ) 1 ∞ θ − 2πk  ω → ⋅   H a () T ∑ H a T k =−∞  T 

The frequency response of the digital filter is an aliased version of the frequency response of the corresponding .

430430 Impulse invariance may only be used for narrow band LPF H L (ω)

“Negligible” aliasing

ω ω ⋅ω p s ~ 10 s

431431 Design example (Butterworth)

ω = p 500 Hz ω = s 2750 Hz = Fs 50 KHz δ = δ = p s 0.01 θ = π p 0.02 θ = π s 0.11 δ = δ = p s 0.01

432432 Design a LPF using Butterworth analog filter and impulse invariance method ω T θ Selectivit y k = p = p = 0.1818 ω θ s T s − δ 2 −2 ()1− −1 2.03040506 ⋅10 − Discrimina tion d = p = =1.426 ⋅10 3 δ −2 − s 1 9999 − log d 2.846 n ≥ = = 3.85 → 4 − log k 0.74 1 rad L ω = ≥ −δ = ⇒ H ()p 8 1 p 0.99 5113 []813 Hz  2π 500  sec 1+    ω   c 

433433 1 Prototype : H(s) = s4 + 2.6131 s3 + 3.4142 s2 + 2.6131 s + 1 s s ← 5113 1 H(s) = 1.4632 ⋅10 −15 s4 + 1.9549 ⋅10 −11 s3 + 1.306 ⋅10 −7 s2 + 5.1107 ⋅10 −4 s + 1

5000 x 4000

3000 2000 x 1000

0

-1000

-2000 x

-3000

-4000 x -5000 -5000 -4000 -3000 -2000 -1000 0 1000 2000 3000 4000 5000

434434 Partial fractions 4724 −1957 j 4724 +1957 j H L(s) = .0 8535 ()1− j + .0 8535 ()1+ j s − ()− 4724 +1957 j s − ()− 4724 −1957 j 1957 − 4724 j 1957 + 4724 j + .0 3535 ()−1− j + .0 3535 ()−1+ j s − ()−1957 + 4724 j s − ()−1957 − 4724 j

α αT − ⇒ T = 2⋅10 5 s − ()−α 1− e−αT ⋅ z −1 806 4. − 334 1. j 806 4. + 334 1. j ()1− j ()1+ j H(z) = 100 + 100  − .9 448 + .3 914 j  −  − .9 448 − .3 914 j  − 1− exp  ⋅ z 1 1− exp  ⋅ z 1  100   100  138 4. − 334 j 138 4. + 334 j ()−1− j ()−1+ j + 100 + 100  − .3 914 + .9 448 j  −  − .3 914 − .9 448 j  − 1− exp  ⋅ z 1 1− exp  ⋅ z 1  100   100 

435435 1 − 2 + 7.657 ⋅ z −1 + 0.475 ⋅ z −2 + 3.437 ⋅ z −3 H ()z = ⋅ 1000 1− 3.733 ⋅ z −1 + 5.234 ⋅ z −2 − 3.2664 ⋅ z −3 + 0.7655 ⋅ z −4

1

0.8

0.6

0.4

0.2

0

-0.2

-0.4

-0.6

-0.8

-1 -1 -0.5 0 0.5 1 436436 0

-20

-40

-60 |H| (dB) |H|

-80

-100

-120 0 0.5 1 1.5 2 2.5 4 f (Hz) x 10

θ = π s

The monotonic roll-off is not kept due to aliasing 437437 0

-10

-20

-30 |H| (dB) |H|

-40

-50

-60

0 500 1000 1500 2000 2500 3000 3500 4000 f (Hz)

2750Hz <-40dB θ = π s 0.11

438438 0.05

0

-0.05 |H| (dB) |H| -0.1

-0.15

-0.2 0 100 200 300 400 500 f (Hz)

500Hz δ >-0.09dB ( s=0.01) θ = π s 0.02 439439 Step invariance

Given an analog filter with a known step response, build a digital filter whose step response is a sampled version the analog filter

Analog filter

Step response

Sample of step response 440440 Step invariance

Z domain step response

δ (n)= u(n)− u(n −1) Using H (z)= (1− z −1 )R(z) where R(z) is the step respose

  −1  −1 H a (s) Z domain unit H ()z = ()1− z Z L   sample response  s t=kT 

441441 Step invariance example as H ()s = High pass s + a

− H ()s − a − L 1 = L 1 = ae at u(t) s s + a aT ()1− z −1 H ()z = 1− e−aT z −1

Pole transform similar to impulse invariance

442442 101 H L (s) = s2 + 2s +101

−  101  H (z) = 1( − z 1)Z   s(s2 + 2s +101 ) z −1 1 s +1 1  = Z  − −  z s (s + )1 2 +100 (s + )1 2 +100  −  2 − −T −T  = z 1 z − z ze cos 10 T − ze sin 10 T  2 −T −2T 2 −T −2T  z  z −1 z − 2ze cos 10 T + e 10 (z − 2ze cos 10 T + e )

Continuous π T = 5

443443 Bilinear transform

 Algebraic method to convert analog filters to digital IIR filters  No sampling –no aliasing  Applicable to Low pass, High pass, band pass, band stop, etc.  Simple – No Laplace or Z transforms  Frequency warp –easy to deal with

444444 Integral approximation

445445 Trapezoidal approximation

446446 Difference equation

447447 Transformation formula

“continuous time” “discrete time” integrator integrator

Bilinear transform

448448 Single pole filters

LP: Zero at z=- 1

HP: Zero at z=1

449449 Bilinear transform A single analog stable pole is transformed to a single digital stable pole

Both numerator and denominator have the same order

450450 In general

Conversion of analog filter

Digital filter has p zeros and poles. If p>q, p-q zeros are added at z=-1 (LP)

451451 Mapping of ss--planeplane into the zz-- plane

452452 Bilinear Transformation

Mapping of ss--planeplane into the zz--plane.plane. Analog stable poles are converted to digital stable poles

453453 Bilinear Transformation

The bilinear transformation has the quality that every point in the s plane maps into a unique point in the z plane, and vice versa . Also, the left half of the s plane maps into the interior of the unit circle in the z plane so a stable s- domain system is transformed into a stable z- domain system.

454454 Frequency transform (analog imaginary line to digital unit circle)

Since

We may convert frequency variables

455455 Frequency transform (analog imaginary line to digital unit circle)

For low frequencies

456456 Frequency warp

457457 Bilinear Transformation  Mapping is nonlinear  Complete negative imaginary axis in the ss--planeplane from ω = −∞ to 0 is mapped into the lower half of the unit circle in the zz--plane from z = − 1 to z = 1  Complete positive imaginary axis in the ss--planeplane from ω = 0 to ω = ∞ is mapped into the upper half of the unit circle in the zz--planeplane from z = 1 to z = −1

458458 Bilinear transform

 Transformation can be used only to design digital filters with prescribed magnitude response with piecewise constant values  Transformation does not preserve phase response of analog filter

22..459459 Frequency warp

460460 Pre warp

IIR Filter specifications are given in the digital domain. When analog filter is transformed to digital filter using bilinear transform frequency warping takes place To compensate, frequencies in spec. are Pre-Warp before translated to analog domain.

Note: since we compensate for warping, selection of T is arbitrary

461461 Step 1:1: Specification of Filter

 Specify performance H(θ ) at certain frequencies

 E.g. cutcut--offoff frequency

 RollRoll--offoff frequency  Low pass filter example

θ Desired cut-off C frequency θ C 462462 Step 2:2: Pre--WarpWarp Frequencies

 Warp specified H(ω) frequencies using

2 θ  ω = tan  c  C T  2 

ω Warped cut-off c frequency

ω c 463463 Step 3:3: Design Analogue Filter

 Design analog filter ω H A ( )  Analogue filter Analogue design produces filter response

 HAA(s)

ω c 464464 Step 4:4: Apply Bilinear Transform  Transform H(θ ) H(s) H(z) Digital filter response  Means replace s by

 Result

 Transfer function, H(z) ω for digital filter c 465465 Example

 Design a discrete filter, with specifications

 Butterworth filter

 --33dBdB cut--offcut off at 22kHzkHz

 Attenuation of at least 1010 dB at 44kHz

 Sampling frequency 2020kHzkHz

466466  Digital frequencies

 CutCut--offoff frequency --33dBdB ω π π × θ = c = 2 fc = 2 2000 = π c 0.2 fs fs 20,000

 RollRoll--offoff frequency --1010dBdB ω π π × θ = r = 2 fr = 2 4000 = π r 0.4 fs fs 20,000

467467  Conversion to digital

 PrePre--warpwarp frequencies

 Use bilinear transform

 Pre--warpwarp cutcut--offoff frequency T=2 θ   0.2π  ω' = tan c  = tan  = 0.325 c  2   2 

468468  Pre--warpwarp rollroll--offoff frequency θ   0.4π  ω' = tan r  = tan  = 0.726 r  2   2 

 Need normalised frequencies

 To get normalised Butterworth from table 0.325 0.726 0.325 → =1 0.726 → = 2.234 0.325 0.325 Cut-off frequency Roll-off frequency

Using Butterworth formula N>1.37  N=2

469469  Normalised Butterworth for order 22  From table

 Normalised Butterworth, order 2 isis

= 1 H c(BW ) (s) s 2 + 2s +1

470470 Replace ss by s 0.325

1 = prototype Hc(BW ) (s) s2 + 2s +1

= 1 Hc ()s 1 s2 + 2 s +1 0.325 2 0.325

471471  Actual pre--warpedwarped analogue filter is 2 = 0.325 Hc (s) 2 + 2×0.325 2 + 2 s 0.325 s 0.325

0.106 H (s) = c s 2 + 0.46s + 0.106

472472 z −1  Use bilinear transform s = z +1  Filter becomes 0.106 H()z = z−1 2 + z−1 + ()z+1 0.46()z+1 0.106 0.068(z +1)2 H (z) = d z2 −1.142z +0.413 473473 =-3dB <-10dB 0

-10

-20

-30

-40 |H| (dB) |H| -50

-60

-70

-80 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 f (Hz)

474474 Digital Filter Structures

 The causal IIR digital filters are characterized by a real rational transfer − function of z 1 or, equivalently by a constant coefficient difference equation  From the difference equation representation, it can be seen that the realization of the causal IIR digital filters requires some form of feedback

475475 Direct Form IIR Digital Filter Structures

476476 Direct Form IIR

q – Numerator order p+q delays p - Denominator order p+q+1 multipliers (p+q+1)*Fs multiplication/second 477477  We may replace the order of filter sections

478478 Canonical form

479479 Canonic Form IIR

Max(p,q) delays p+q+1 multipliers (p+q+1)*Fs multiplication/second

480480 MultiMulti--raterate Digital Signal Processing

481481 Example: TV program conversion Europe (ex. France) Temporal and National Television System spatial Phase Alternating Line Committee sampling rate 25 frames/second 30 frames/second conversion 625 lines per frame 525 lines per frame QAM Color modulated to QAM Color modulated to 4.43MHz 3.58MHz Color US/Japan information sampling rate conversion

Séquentiel couleur à mémoire 25 frames/second 625 lines per frame 312 Color lines FM Color modulated to 4.43MHz France 482482 Example: Sampling – Conventional approach Anti aliasing

Analog Voice LPF 8Ksps ~3.5KHz 0.99 @3.5KHz A/D bandwidth 0.01@4Khz

~ Order 45 Butterworth Analog filter. Not practical

0

-10

-20

Ha(w)| -30

-40

-50

0 500 1000 1500 2000 2500 3000 3500 4000 Hz 483483

Analog 3.5KHz Voice LPF 800Ksps LPF ~3.5KHz 0.99 @3.5KHz A/D Linear 100 bandwidth 0.01@400Khz Phase FIR

Very simple order 2 Butterworth Analog filter

0

-10 -20 Narrowband -30 digital signal

-40

Ha(w)| -50

-60

-70 Note: Decimation -80 enhances signal -90 0 1 2 3 4 5 6 7 8 9 10 resolution 5 Hz x 10 484484 Analog Devices’ AD1870 64X Oversampling

485485 Example: Reconstruction– Conventional approach

Analog Digital voice 8Ksps LPF ~3.5KHz ZOH 0.99 @3.5KHz bandwidth 0.01@4Khz

~ Order 45 Butterworth Analog filter. Not practical

486486 Example: Reconstruction– Up sampling

Digital x100 Analog voice 800Ksps LPF Digital ~3.5KHz ZOH 0.99 @3.5KHz bandwidth Interpolation 0.01@400KHz

Narrowband Simple 2 pole digital signal Butterworth Analog filter

487487 Time domain

1 1

0.8 0.8

0.6 0.6

0.4 0.4

0.2 0.2

0 0

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

Conventional ZOH X10 Up-sampling

488488 Analog Devices’ AD1853 8X Oversampling

489489 Now we know what that means…

490490 Multirate Digital Signal Processing Basic Sampling Rate Alteration Devices  Interpolator (Up--sampler)sampler) --UsedUsed to increase the sampling rate by an integer factor  Decimator (Down--sampler)sampler) --UsedUsed to decrease the sampling rate by an integer factor

491491 Up--samplingsampling

Ideal sinc() x(t) Sample at reconstructio x[n] L Fs x[m] n Fs L Fs

We assume original x[n] was sampled according to Nyquist rule. Ts Sampling at L Fs complies with Nyquist Ts / L

492492 Shannon Reconstruction

  mT −   ∞  nT  = T =  L  = xu []m xa m  ∑x[]n sinc   =−∞   L n  T    ∞  m−nL  = ∑x[]n sinc   n=−∞  L 

493493 Defin x[l L] l mod L = 0 l = Ln e y[]l =   0 otherwise ∞  −  = m l xu [][]m ∑y l sinc   l=−∞  L  Convolution between y[m] and An ideal non-causal digital [-π/L , +π/L] Low pass filter

In practice we shall use a practical LPF

494494 y[m] x[n] L LPF xu[m] Fs L Fs [-π/L , + π/L] L Fs

Graphs are for L=3

495495 Up--SamplerSampler  Up--samplingsampling operation is implemented by inserting L--11 zero--valuedvalued samples between two consecutive samples of xx[[n]  Linear and time dependant

x[m /L], m = 0,± L,± 2L,L x[n] L y[m] =   0, otherwise

496496 Up--SamplerSampler

 In terms of the zz--transform,transform, the input--input output relation is then given by

∞ ∞ Y (z) = ∑ y[m] z −m = ∑ x[m / L] z −m = m=−∞ m=−∞ m mod L=0 n = m L ∞ = ∑ x[n] z −nL = X ()z L n=−∞

497497 Up--SamplerSampler

L Y (z) = X (z ) Frequency domain is scaled by ratio L Y ()()e jθ = X e jθL

L= 2 θ X(e j ) − 2π 2π

θ Y(e j ) − 2π −π π 2π

498498 Up--SamplerSampler

 As can be seen, a factorfactor--ofof--LL sampling rate expansion leads to a compressionX (e jθ ) of by a factor of L and a L--foldfold repetition in the baseband [ --π, π]]  This process is called imaging as we get an additional “ image” of the input spectrum

499499 Interpolation filter

500500 Filter

 A practical LPF may be either FIR or IIR  FIR Linear phase is often an advantage  Special computation savings when using dual form FIR

501501 Dual form FIR x[n] L

b2 b1 b0

Z-1 + Z-1 + y[m]

Note: Each multiplier is periodically fed with L-1 zeros and 1 non–zero input.

L = L

502502 Dual form FIR x[n]

b2 b1 b0

L L L

Z-1 + Z-1 + y[m]

Multiplications are done in the ** low ** sampling frequency

503503 Interpolation filter

Total of ½*N*F multiplications per second instead of ½*N*F *L if multipliers are implemented at higher sampling rate 504504 Example: Reconstruction– Up sampling

Digital x100 Analog voice 800Ksps LPF Digital ~3.5KHz ZOH 0.99 @3.5KHz bandwidth Interpolation 0.01@4Khz

Simple 2 pole Butterworth Analog filter 100 LPF [-π/100, π/100]

505505 π LPF 3.5 / 400 [-π/100, π/100] ~ ~

π/100 = π 4 / 400 π

δ =δ = Filter is designed Example p s 0.01 using Remez filter at high sampling rate but D∞ ()δ ,δ 1.9 N ≈ p s = = 3040 multipliers work ∆f F 500 800 ,000 at low sampling rate. multiplications 1/ 2⋅F ⋅ N = 8000 ⋅3040 = 24 ⋅10 6 second

We shall talk about better implementations 506506 Down--SamplerSampler  Down--samplingsampling operation is implemented by keeping every M--thth sample of xx[[n] and removing M--11 in--betweenbetween samples to generate yy[[n]]  Linear and time dependant yy[[n] = xx[[nM]]

x[n] M y[n]

Lower sampling rate will result in aliasing 507507 Decimation

= = x[n] xa (nT ) M y[n] xa (nMT )

Input sampling frequency Output sampling frequency 1 F 1 F = F ' = T = T T T M T '

508508 FrequencyFrequency--DomainDomain Characterization  Applying the zz--transformtransform to the inputinput--outputoutput relation of a factorfactor--ofof--M downdown--samplersampler y[n] = x[Mn] we get

∞ − Y(z) = ∑ x[Mn ]z n n=−∞

509509  Define a new sequencexint [ n ] : x[n], n = 0,± M ,± 2M ,K x [n] =  int  0, otherwise

M M

x[n] y[m] xint [n]

∞ ∞ = −n = −n Y(z) ∑ x[Mn ]z ∑ xint [Mn ]z n=−∞ n=−∞ ∞ = −k / M = 1/ M ∑ xint [k]z X int (z ) =−∞ k 510510  xint [n] can be formally related to xx[[n] = ⋅ through xint [n] c[n] x[n] 1, n = 0,± M ,± 2M ,K where c[n] =  0, otherwise

 Recall that cc[[n] may be given by 1 M −1 c[n] = ∑ W kn M M where k=0 = − j2π / M WM e

511511  Taking the zz--transformtransform of = ⋅ xint [n] c[n] x[n] and making use of M −1 = 1 kn c[n] ∑ WM M k=0

∞ ∞  M −1  −n 1  kn  −n X int (z) = ∑c[n]x[n]z = ∑ ∑ WM  x[n]z n=−∞ M n=−∞ k=0  M −1 ∞  M −1 1  kn −n  1 −k = ∑ ∑ x[n]WM z  = ∑ X (zWM ) M k=0 n=−∞  M k=0

512512 For k=0 – Base spectrum 0

M −1 1 1  −  = 1 M =  k ⋅ M  Y()z Xint ()z ∑X WM z  M k=0  

M −1 θ θ 1  −  j = k ⋅ j M = Y(e ) ∑X WM e  M k=0  

− ()θ−2πk 1 M 1  j   M  = ∑X e  M k=0  

513513 Example M=2

− 2π −π π 2π

K=0

−4π −2π 2π 4π

K=1

−4π −2π 2π 4π

Total aliasin g −4π −2π 2π 4π Decimation

 The Nyquistfrequency after decimation is 11/M/M the original Nyquistfrequency  aliasing  In order to prevent aliasing signal should be band limited to --π/M, +π/M before decimation

515515 Decimation filter

516516 Example - Oversampling

Analog 3.5KHz Voice LPF 800Ksps LPF ~3.5KHz 0.99 @3.5KHz A/D Linear 100 bandwidth 0.01@400Khz Phase FIR

LPF 100 [-π/100, π/100] We already designed this one today

517517 Direct implementation

½ when GLP filters are used 518518 Better implementation (FIR)

½ when GLP filters are used 519519 Filters for Fractional Sampling Rate Alteration  A fractional change in the sampling rate can be achieved by cascading a factorfactor--ofof-- M decimator with a factorfactor--ofof--L interpolator, where M and L are positive integers  Such a cascade is equivalent to a decimator with a decimation factor of M//L or an interpolator with an interpolation factor of L//M

520520 Filters for Fractional Sampling Rate Alteration

H(z) H (z) M L u d

521521 Filters for Fractional Sampling Rate Alteration  Hence, the desired configuration for the fractional sampling rate alteration is as indicated below where the lowpass filter H((zz) has a stopband edge frequency given by  π π  θ = min  ,  s  L M 

L H(z) M

522522 523523 8Ksps 100 Filter is designed is designed Filter sampling high for rate. are Multiplications ** the low in done sampling ** frequency tions π /100] π second filter

/100, ~ π multiplica LPF [- ~ 6 3040 Remez = 10

⋅ 12 000 , = using 800Ksp s π 9 . 1 800 01 3040 . π ⋅ 0 500 4 / 400 400 / 4 = = s 8000 δ s 2 1 = δ 3.5 / 400 400 / 3.5 , F p = p δ

f δ () N ∆ ⋅ ∞ D F ⋅ ≈ 2 / N Example 1 Decimation system we designed designed Decimation systemwe few slides ago MultiMulti--stagestage decimation system Split decimation into few stages

M=M1*M2*M3….. may substantially reduce processing requirements

LPF 1 50 LPF 2 2

M=100=2*50=50*2=4*25=25*4=2*5*10=5*2*5*2=…..

Optimal selection of Mi may be found by trial-and-error or by graphs found in R. E. Crochiere & L. R. Rabiner, Multirate Digital Signal Processing, Prentice- Hall, 1983

524524 Filters in series H1(z)H2(z) θ δ p1 1± p 1 δ s1 θ s1 δ θ 1± p p2 2 δ s2 θ π s2

Pass band

Transition Stop band

δ δ ≈ δ δ ≈ (1± p1) (1± p2) s1(1± p2) δ δ < δ δ δ s1 s2 1±( p1+ p2) s1 δ δ 525525 s1, s2 In general, N filters in series

 Assume

 δδ δδ δδ pp11= pp22= … = pp

 δδ δδ δδ ss11= ss22= … = ss  Connecting N filters in series we (approximately) get

 δδ PassPass--band:band: 11+N+N pp

 δδ StopStop--band:band: ss  δδ δδ If specifications define s ,, pp for the overall filter, for every δδ δδ sub filter we define s ,, pp/N

526526 Equi-ripple filter order can be estimated by

Transition band (Hz) Sampling Rate (Hz)

527527 δδ δδ Example M=100,K=22,, s = pp==00..0101 Fp==33..55KHzKHz Fs=44KHzKHz Second filter

16Ksps 8Ksps 2 δ 3.5KHz LPF 2 p=0.005

δ s=0.01 7π/16 π/2=π/Μ π Note: second 2 filter removes 8KHz 4KHz frequencies between 4KHz δ =δ = = and 8KHz Example p s 0.01 K 2

D∞ ()δ / 2,δ 2.15 N ≈ p s = = 69 ∆f F 500 16 ,000 1 multiplications 1/ 2⋅F ⋅ N = 8000 ⋅69 = 276 ⋅10 3 2 second

528528 δδ δδ Example M=100,K=22,, s = pp==00..0101 Fp==33..55KHzKHz Fs=44KHzKHz First filter no aliasing

800Ksps 16Ksps δ =0.005 p LPF 1 50 δ s=0.01 3.5KHz Motivation – Wider transition Filter replica after band – shorter decimation 4KHz 8KHz filter ~ ~

Will be removed 16KHz π by second filter 400Ksps Post decimation sampling rate θ π p=3.5/400 θ π=π/50=π/Μ s=8/400 1 529529 δδ δδ Example M=100100,K=,K=22,, s = pp==00..0101 FpFp==33..55KHzKHz Fs=44KHzKHz First filter controlled aliasing

800Ksps 16Ksps δ =0.005 p LPF 1 50 δ s=0.01 3.5KHz Motivation – Wider transition 8KHz Filter replica after band – shorter decimation filter ~ ~ 4KHz 12KHz 16KHz π Will be removed by second filter 400Ksps Post decimation sampling rate θ π p=3.5/400 θ π s=12/400 530530 δ =δ = = Example p s 0.01 K 2

D∞ ()δ / 2,δ 2.15 N ≈ p s = = 202 ∆f F ()12 −3.5 800 1 multiplications 1/ 2⋅F ⋅ N = 16000 ⋅202 =1.6⋅10 6 2 second

Total of 2M Multiplications/second Compared with original 12M !

531531 Interpolation system

8Ksps LPF 800Ksps 100 [-π/100, π/100]

8Ksps 2 LPF 2 50 LPF 1 800Ksps 16Ksps

532532 8Ksps 2 LPF 2 16Ksps

7π/16 3.5KHz @Fs=16Ksps Replica being Original removed by spectrum filter π/ 2 π 2π 4KHz 8KHz 16KHz

2π 533533 16KHz 16Ksps 50 LPF 1 800Ksp s

3.5KHz @Fs=800Ksp Replica being s removed by

filter ~ ~

4KHz 12 KHz 16π/400 π

16KHz 400Ksp s ~ ~

3.5KHz π 400Ksp 534534 s Example Narrowband filters – Legacy approach

LPF 800Ksps 800Ksps [-π/100, π/100]

Note: No decimation, just filter

δ = δ = Example p s 0.01 using Remez filter

D∞ ()δ ,δ 1.9 N ≈ p s = = 3040 ∆f F 500 800 ,000 1 multiplica tions 1/ 2⋅ F ⋅ N = 800 ,000 ⋅3040 =1.2⋅10 9 2 second

535535 Narrowband filters –multi rate approach 800Ksps

LPF 1 50 LPF 2 2

8Ksps 2 LPF 2 50 LPF 1 800 Ksps

Even tough no sampling rate change is needed, the multi-rate system consume 4*10 6 multiplications/sec compared with 10 9 multiplications/sec for the straight forward approach !!!!

536536 MultiMulti--raterate identities

L X(z) L X(z )

L L X(z) H(z) L X(z ) H(z )

X(z) L H(zL) X(z L) H(z L)

537537 Identities

L H(z L) x(n) y(m)

H(z) L x(n) y(m)

M H(z) x(n) z(l)

H(z M) M x(n) z(l)

538538 Polyphase representation of FIR filter unit sample response M=3 1

0.8

0.6

0.4

0.2

0

-0.2

-0.4

-0.6 0 2 4 6 8 10 12 14 16

539539 Polyphase representation of FIR filter unit sample response M=3 1

0

-1 0 2 4 6 8 10 12 14 16 18

1

0

-1 0 2 4 6 8 10 12 14 16 18

1

0

-1 0 2 4 6 8 10 12 14 16 18 540540 = + −1 + −2 + + −N = H(z) h0 h1z h2z ... hN z = + −M + −2M + + [h0 hM z h2M z ...] + −1 + −()()M +1 + − 2M +1 + + [h1z hM +1z h2M+1z ...] ..... +...] + + −()()()M−1 + − 2M−1 + − 3M −1 + = [hM−1z h2M −1z h3M−1z ...]

= + −M + −2M + + [h0 hM z h2M z ...] + z−1[h + h z−M +h z−2M +...] + 1 M +1 2M +1 M x ..... +... + FIR filters in Z -M + −()M−1 + −M + −2M + = z [hM −1 h2M −1z h3M −1z ...]

= M + −1 M + + −()M −1 M H0 ()()z z H1 z .. z HM−1()z 541541 Polyphase decimation filter

= M + −1 M + + −(M −1) M H(z) H0 (z ) z H1(z ) .. z HM−1(z )

x(n) M H0(z )

z-1

M y(m) H1(z ) + M z-1

M H2(z )

z-1 …

M HM-1(z ) 542542 Using an identity Active only for n=…-M,0,M,2M,..

Active only for n=…- x(n) M+1,1,M+1,2M+1,.. M H0(z) z-1 + y(m) M H1(z) z-1 M H2(z)

z-1 … M H (z) Active only for n=…- M-1 M+2,2,M+2,2M+2,..

Active only for n=…-1,M-1,2M-1,3M-1,.. 543543 Commutator switch implementation

n=…-M,0,M,2M,.. n=…-M+1,1,M+1,2M+1,.. x(n) H0(z)

+ y(m) n=…-M+2,2,M+2,2M+2,.. H1(z)

n=…-1,M-1,2M-1,3M-1,.. H2(z) …

HM-1(z)

544544 Polyphase interpolation filter

= L + −1 L + + −(L−1) L H(z) H0 (z ) z H1(z ) .. z HL−1(z )

x(n) L y(m) L H0(z ) + z-1

L H1(z ) +

z-1

L H2(z ) + … z-1

L HL-1(z ) 545545 Polyphase interpolation filter

Nonzero for m mod L=0 x(n) y(m) H0(z) L + z-1 Nonzero for m mod L= 1 H1(z) L +

z-1 Nonzero for m mod L=2 H2(z) L + … z-1

HL-1(z) L Nonzero for m mod L=L-1 546546 Polyphase interpolation filter

= L + −1 L + + −(L−1) L H(z) H0 (z ) z H1(z ) .. z HL−1(z )

m mod L=0 x(n) y(m) H0(z)

H1(z)

H2(z) …

HM-1(z) 547547 Introduction to Digital Signal processing --conclusionconclusion

-Preliminaries -Fourier analysis -s and z domain analysis -Analog filter design (wannabe) -Signal and systems

548548 Introduction to Digital Signal processing --topicstopics  Signal and system revisited  Poisson formulas  Sampling, Nyquist,Nyquist , Shannon  DFT

 FFT

 Cyclic convolution

 Spectral analysis

549549 Introduction to Digital Signal processing --topicstopics  Filters

 Continuous phase

 Linear phase

 Minimum phase

 All pass

 Implementations ––directdirect and canonic  FIR

 Types

 IRT with and without windows

 EquiEqui--rippleripple

550550 Introduction to Digital Signal processing --topicstopics  IIR

 Analog filter: •• Butterworth •• ChebyshevChebyshev,, Elliptic, Bessel ––IntroductionIntroduction only

 Transformation •• Impulse and step invariance •• Bilinear  MultiMulti--raterate

 Decimation

 Interpolation

 Rate change

 Polyphase

 Multistage 551551 What’s next ? המעבדה לעיבוד אותות דיבור ותמונה –– Project at the SIPL  אותות אקראיים –– Radom signals 

 Models of random signals and processes

 System manipulation of random signals

 Noise sources עיבוד אותות –– Signal Processing 

 Quantization and finite word length

 Fixed point and floating point DSP

 Spectrum analysis, periodograms

 Filter banks, QMF filters

 Short time Fourier transform

 Wavelet transform

552552 ענענ""ת –– Image processing and analysis 

 Human vision

 22DD signal processing

 Image enhancement

 Image coding קידוד אותות –– Digital coding 

 Scalar and vector quantization

 Entropy coding

 Waveform coding

 Frequency domain coding

 Linear Prediction

 LPC based speech coders

553553 עיבוד –– Discrete time random signal processing  אותות אקראיים בזמן בדיד

 Hilbert space representation of ransom signals

 Parametric models

 Theoretic bounds עיבוד אותות מסתגל –– Adaptive signal processing 

 Adaptive algorithms –– LMS RLS

 Adaptive filtering  Linear estimation in dynamic systems -- שיערוך לינארי במערכות דינמיות

 Wiener filter

 Kalman filter

 Hidden Markov models 554554