FILTER DESIGN WORKSHOP

Domingo Rodríguez

Automated Information Processing (AIP) Lab. Electrical and Computer Engineering Department

INEL 4102, INEL 4095, INEL 4301, & INEL 5309

FILTER DESIGN WORKSHOP – January 17, 2017 Workshop Outline Analog Filters A Quick Basic Introduction A More Detailed Introduction Digital Filters A Digital Filter Design Approach Filter Design Filter Design Using MATLAB FDATool Design Technique PSPICE

2 Filter Simulation Using PSPICE ANALOG FILTERS

3 Filters

Background:

. Filters may be classified as either digital or analog.

. are implemented using a digital computer or special purpose digital hardware.

. may be classified as either passive or active and are usually implemented with R, L, and C components and operational amplifiers.

4 Courtesy of the University of Tennessee Filters Background:

. An is one that, along with R, L, and C components, also contains an energy source, such as that derived from an operational amplifier.

. A is one that contains only R, L, and C components. It is not necessary that all three be present. L is often omitted (on purpose) from passive filter design because of the size and cost of – and they also carry along an R that must be included in the design. 5 Filters Background:

. The of analog filters is well described in filter text books. The most popular include Butterworth, Chebyshev and elliptic methods.

. The (realization) of analog filters, that is, the way one builds (topological layout) the filters, received significant attention during 1940 thru 1960. Leading the work were Cauer and Tuttle. Since that time, very little effort has been directed to analog filter realization.

6 Background: Filters

. Generally speaking, digital filters have become the focus of attention in the last 40 years. The interest in digital filters started with the advent of the digital computer, especially the affordable PC and special purpose signal processing boards. People who led the way in the work (the analysis part) were Kaiser, Gold, and Rader.

. A digital filter is simply the implementation of an equation(s) in computer software. There are no R, L, C components as such. However, digital filters can also be built directly into special purpose computers in hardware form. But the execution is still in software.

7 Filters Background:

. In this course we will only be concerned with an introduction to filters. We will look at both passive and active filters; but, will concentrate on passive filters.

. We will not cover any particular design or realization methods in detail; but, rather use our understanding of poles and zeros in the s-plane, for basic designs.

. All EE and CE undergraduate students should take a course in digital filter design, as an opinion.

8 Passive Analog Filters

Background: Four types of filters - “Ideal”

lowpass highpass

bandpass bandstop

9 Passive Analog Filters

Background: Realistic Filters:

lowpass highpass

bandpass bandstop

10 Passive Analog Filters

Background:

It will be shown later that the ideal filter, sometimes called a “brickwall” filter, can be approached by making the order of the filter higher and higher.

The order here refers to the order of the polynomial(s) that are used to define the filter. MATLAB examples will be given later to illustrate this.

11 Passive Analog Filters

Low Pass Filter Consider the circuit below.

+ + R

VI C VO _ _

Low pass filter circuit

1 V() jw jwC 1 O  1 Vi( jw )R 1 jwRC jwC

12 Passive Analog Filters

Low Pass Filter

0 dB -3 dB . Bode

1/RC  Passes low frequencies Attenuates high frequencies

1 x 0.707 Linear Plot

0 1/RC  13 Passive Analog Filters

High Pass Filter Consider the circuit below.

+ C + Vi R _ VO _

High Pass Filter

V() jwR jwRC O  1 Vi( jw )R  1 jwRC jwC 14 Passive Analog Filters

High Pass Filter

0 dB . -3 dB Passes high frequencies Bode 1/RC Attenuates low frequencies

1/RC 

1 0.707 x.

Linear

15 0 1/RC  Passive Analog Filters

Bandpass Filter Consider the circuit shown below:

+ + C L VO Vi R _ _

When studying series resonant circuit we showed that;

R Vs() s O  L R 1 Vsi () ss2  L LC 16 Passive Analog Filters

Bandpass Filter We can make a bandpass from the previous equation and select the poles where we like. In a typical case we have the following shapes.

0 dB -3 dB . . Bode

 lo hi 

1 . . 0.707 Linear

0 lo hi  17 Passive Analog Filters

Bandpass Filter Example Suppose we use the previous series RLC circuit with output across R to design a bandpass filter. We will place poles at –200 rad/sec and – 2000 rad/sec hoping that our –3 dB points will be located there and hence have a bandwidth of 1800 rad/sec. To match the RLC circuit form we use:

220022002200sss  2 ss ss2200 400000 (ss 200)( 2000) 200x 2000(1)(1) 200 2000 The last term on the right can be finally put in Bode form as; 0.0055 jw jwjw (1)(1) 2002000

18 Passive Analog Filters

Bandpass Filter Example From this last expression we notice from the part involving the zero we have in dB form; 20log(.0055) + 20logw

Evaluating at w = 200, the first pole break, we get a 0.828 dB what this means is that our –3dB point will not be at 200 because we do not have 0 dB at 200. If we could lower the gain by 0.829 dB we would have – 3dB at 200 but with the RLC circuit we are stuck with what we have. What this means is that the – 3 dB point will be at a lower frequency. We can calculate this from 200 dB logx 20 0.828 dB wlow dec 19 Passive Analog Filters

Bandpass Filter Example

This gives an wlow = 182 rad/sec. A similar thing occurs at whi where the new calculated value for whi becomes 2200. These calculations do no take into account a 0.1 dB that one pole induces on the other

pole. This will make wlo somewhat lower and whi somewhat higher.

One other thing that should have given us a hint that our w1 and w2 were not going to be correct is the following:

R s L ()w12 w s  2 2 R 1 (())s w  w s  w w ()ss 1 2 1 2 L LC What is the problem with this?

20 Passive Analog Filters

Bandpass Filter Example

The problem is that we have R wwBWww () L 1221

Therein lies the problem. Obviously the above cannot be true and that is why we have aproblem at the –3 dB points.

We can write a Matlab program and actually check all of this.

We will expect that w1 will be lower than 200 rad/sec and w2 will be higher than 2000 rad/sec.

21 Passive Analog Filters

Bode Diagrams

From: U(1) 0 -3 dB

-5 dB -5

-10

-15

100

50

Phase (deg); Magnitude (dB) Magnitude (deg); Phase 0

To: Y(1) To: -50

-100 2 3 4 10 10 10 22 Frequency (rad/sec) A Bandpass Digital Filter

Perhaps going in the direction to stimulate your interest in taking a course on filtering, a 10 order analog bandpass will be simulated using Matlab. The program is given below.

N = 10; %10th order butterworth analog prototype

[ZB, PB, KB] = buttap(N); numzb = poly([ZB]); denpb = poly([PB]);

wo = 600; bw = 200; % wo is the center freq % bw is the bandwidth [numbbs,denbbs] = lp2bs(numzb,denpb,wo,bw);

w = 1:1:1200;

Hbbs = freqs(numbbs,denbbs,w); Hb = abs(Hbbs);

plot(w,Hb) grid xlabel('Amplitude') ylabel('frequency (rad/sec)') title('10th order Butterworth filter') 23 A Bandpass Filter

24 RLC Band Stop Filter

Consider the circuit below:

R + + L V V O i _ Gv (s) C _

The transfer function for VO/Vi can be expressed as follows: 1 s 2  G (s)  LC v R 1 s 2  s  L LC 25 RLC Band Stop Filter

Comments This is of the form of a band stop filter. We see we have complex zeros on the jw axis located at

1  j LC

From the characteristic equation we see we have two poles. The poles an essentially be placed anywhere in the left half of the s-plane. We see that they will be to the left of the zeros on the jw axis.

We now consider an example on how to use this information.

26 RLC Band Stop Filter

Example

Design a band stop filter with a center frequency of 632.5 rad/sec and having poles at –100 rad/sec and –3000 rad/sec.

The transfer function is:

s 2 300000 s 2  3100s  300000

We now write a Matlab program to simulate this transfer function.

27 RLC Band Stop Filter

Example

num = [1 0 300000];

den = [1 3100 300000];

w = 1 : 5 : 10000;

Bode(num,den,w)

28 RLC Band Stop Filter

Example

Bode

Matlab

29 Basic Active Filters

Low pass filter C

Rfb

+ Rin + Vin _ VO _

30 Basic Active Filters

High pass

Rfb

C Rin

+ Vin + _ VO _

31 Basic Active Filters

Band pass filter

C2 R1

C1 R2 Rfb R1 R2 Ri + Vin _ + VO _

32 Basic Active Filters

Band stop filter

C1

R1 R1

Rfb

R R2 i + C2 + V in VO _ _

33 ANALOG FILTERS

34 Filters

A filter is a system that processes a signal in some desired fashion. A continuous-time signal or continuous signal of x(t) is a function of the continuous variable t. A continuous-time signal is often called an analog signal. A discrete-time signal or discrete signal x(kT) is defined only at discrete instances t=kT, where k is an integer and T is the uniform sampling spacing or period between samples 35 Types of Filters

There are two broad categories of filters: An analog filter processes continuous-time signals A digital filter processes discrete-time signals. The analog or digital filters can be subdivided into four categories: Lowpass Filters Highpass Filters Bandstop Filters

36 Bandpass Filters Analog Filter Responses

H(f) H(f)

0 f 0 f fc fc

Ideal “brick wall” filter Practical filter

37 Ideal Filters

Lowpass Filter Highpass Filter

M()

Passband Stopband Stopband Passband

 c   c 

Bandstop Filter Bandpass Filter

M()

Passband Stopband Passband Stopband Passband Stopband

      c1 c2 c1 c2 38 Passive Filters

Passive filters use resistors, , and inductors (RLC networks). To minimize distortion in the filter characteristic, it is desirable to use inductors with high quality factors (remember the model of a practical includes a series resistance), however these are difficult to implement at frequencies below 1 kHz. They are particularly non-ideal (lossy) They are bulky and expensive 39 Active Filters

Active filters overcome these drawbacks and are realized using resistors, capacitors, and active devices (usually op- amps) which can all be integrated: Active filters replace inductors using op-amp based equivalent circuits.

40 Op Amp Advantages

Advantages of active RC filters include: reduced size and weight, and therefore parasitics increased reliability and improved performance simpler design than for passive filters and can realize a wider range of functions as well as providing voltage gain in large quantities, the cost of an IC is less than its passive counterpart 41 Op Amp Disadvantages

Active RC filters also have some disadvantages: limited bandwidth of active devices limits the highest attainable pole frequency and therefore applications above 100 kHz (passive RLC filters can be used up to 500 MHz) the achievable quality factor is also limited require power supplies (unlike passive filters) increased sensitivity to variations in circuit parameters caused by environmental changes compared to passive filters For many applications, particularly in voice and data communications, the economic and performance advantages of active RC filters far outweigh their disadvantages.

42 Bode Plots

Bode plots are important when considering the frequency response characteristics of amplifiers. They plot the magnitude or phase of a transfer function in dB versus frequency.

43 The decibel (dB)

Two levels of power can be compared using a unit of measure called the bel.

P2 B  log10 P1 The decibel is defined as: 1 bel = 10 decibels (dB)

44 Half Power Point

P2 dB 10 log10 P1 A common dB term is the half power point

which is the dB value when the P2 is one- half P1. 1 10 log  3.01dB  3dB 10 2

45 Logarithms

A logarithm is a linear transformation used to simplify mathematical and graphical operations. A logarithm is a one-to-one correspondence.

46 Base Number Representation

Any number (N) can be represented as a base number (b) raised to a power (x). N  (b)x The value power (x) can be determined by taking the logarithm of the number (N) to base (b).

x  log b N

47 Change of Base Logarithm

Although there is no limitation on the numerical value of the base, calculators are designed to handle either base 10 (the common logarithm) or base e (the natural logarithm). Any base can be found in terms of the common logarithm by: 1 log q w  log10 w log10 q

48 Properties of Logarithms

The common or natural The log of the quotient logarithm of the number 1 is 0. of two numbers is the The log of any number less log of the numerator than 1 is a negative number. minus the denominator. The log of the product of two The log a number taken numbers is the sum of the logs to a power is equal to the of the numbers. product of the power and the log of the number.

49 Poles & Zeros of the Transfer Function pole—value of s where the denominator goes to zero. zero—value of s where the numerator goes to zero.

50 Single-Pole Passive Filter

R v Z 1/ sC out  C  vin R  ZC R 1/ sC v C v 1 1/ RC in out   sCR 1 s 1/ RC First order low pass filter Cut-off frequency = 1/RC rad/s Problem : Any load (or source) impedance will change frequency response.

51 Single-Pole Active Filter

R

vin C vout

Same frequency response as passive filter. Buffer amplifier does not load RC network. Output impedance is now zero.

52 Low-Pass and High-Pass Active Filter Designs

High Pass Low Pass

v 1 1 out   v 1 1 sRC in 1 vout 1/ RC sCR sCR  sRC s vin s 1/ RC   RC(s 1/ RC) (s 1/ RC)

53 What are Body plots?

To understand Bode plots, you need to use Laplace transforms! R The transfer function

of the circuit is: Vin(s)

Vo (s) 1/ sC 1 Av    Vin (s) R 1/ sC sRC 1

54 Break Frequency

Replace s with j in the transfer function: 1 1 1 A ( f )    v jRC 1 1 j2RCf  f  1 j   fb  Where f b is called the break frequency, or corner frequency, and is given by: 1 f  b 2RC

55 Corner Frequency

The significance of the break frequency is that it represents the frequency where

Av(f) = 0.707-45. This is where the output of the transfer function has an amplitude 3- dB below the input amplitude, and the output phase is shifted by - 45 relative to the input.

Therefore, f b is also known as the 3-dB frequency or the corner frequency.

56 Body Plot Logarithmic Scale

Bode plots use a logarithmic scale for frequency. One decade

10 20 30 40 50 60 70 80 90 100 200 where a decade is defined as a range of frequencies where the highest and lowest frequencies differ by a factor of 10.

57 Gain or Magnitude of the Transfer Function

Consider the magnitude of the transfer function: 1 A ( f )  v 2 1  f / fb  Expressed in dB, the expression is A ( f )  20 log1 20 log 1 f / f 2 v dB  b  2 2  20 log 1  f / fb   10 log1  f / fb  

 20 log f / fb 

58 Asymptotes Look how the previous expression changes with frequency:

at low frequencies f<< fb,

|Av|dB = 0 dB low frequency asymptote

at high frequencies f>>fb,

|Av(f)|dB = -20log f/ fb high frequency asymptote

59 Note that the two asymptotes intersect at f Low frequency asymptote b Magnitude where |Av(fb )|dB = -20log f/ fb 3 dB 0 0

20 Actual response curve arg( P(  ) ) 20log( P(  ) ) 50 deg 40

High frequency asymptote 60 100 0.1 1 10 100 0.1 1 10 100   rad rad 60 sec sec Bode Plot Filter Approximation

The technique for approximating a filter function based on Bode plots is useful for low order, simple filter designs More complex filter characteristics are more easily approximated by using some well-described rational functions, the roots of which have already been tabulated and are well-known.

61 Real Filters

The approximations to the ideal filter are the: Butterworth filter Cauer (Elliptic) filter

62 Standard Transfer Functions Butterworth Flat Pass-band. 20n dB per decade roll-off. Chebyshev Pass-band ripple. Sharper cut-off than Butterworth. Elliptic Pass-band and stop-band ripple. Even sharper cut-off. Bessel Linear phase response – i.e. no signal distortion in pass-band.

63 Magnitude Plots of Standard Transfer Functions

64 Types of Filters

Butterworth – flat response in the passband and acceptable roll-off Chebyshev – steeper roll-off but exhibits passband ripple (making it unsuitable for audio systems) Bessel – yields a constant propagation delay Elliptical – much more complicated

65 Butterworth Filter

The Butterworth filter magnitude is defined by: 1 M ()  H ( j)  , 1/ 2 1  2n  where n is the order of the filter.

66 Filter Magnitude Approximation

From the previous slide: M (0) 1 1 M(1)  for all values of n 2 For large : 1 M ()   n

67 dB/decade Roll Off

And n 20log10 M ()  20log10 1 20log10 

 20nlog10  implying the M() falls off at 20n dB/decade for large values of .

68 dB/decade Roll Off Examples

10

1 T1 i 20 db/decade T2 i

T3 i 40 db/decade 0.1

60 db/decade

0.01 0.1 1 10 w i 1000

69 Relating Transfer Function and Magnitude Response

To obtain the transfer function H(s) from the magnitude response, note that

2 2 1 M ()  H( j)  H ( j)H ( j)  n 1  2 

70 Complex Conjugation and Frequency Response

Because s  j for the frequency response, we have s2   2. 1 1 H (s)H (s)  n  n 1  s2  1 1 s2n

The poles of this function are given by the roots of

11n s2n  1 e j(2k1) , k 1,2,,2n

71 Pole Calculation

The 2n poles are:

e j[(2k-1)/2n] n even, k = 1,2,...,2n sk = e j(k/n) n odd, k = 0,1,2,...,2n-1

Note that for any n, the poles of the normalized Butterworth filter lie on the unit circle in the s-plane. The left half-plane poles are identified with H(s). The poles associated with H(-s) are mirror images.

72 S-Plane Pole Placement

73 Frequency Response

74 ’s Rectangular and Polar Representations

Recall from complex numbers that the rectangular form of a complex can be represented as: z  x  jy

Recalling that the previous equation is a phasor, we can represent the previous equation in polar form: z  rcos  j sin  where x  r cos and y  r sin

75 Complex Number Definition

Definition: If z = x + jy, we define e z = e x+ jy to be the complex number ez  ex (cos y  jsin y) Note: When z = 0 + jy, we have e jy  (cos y  jsin y)

which we can represent by symbol: e j

76 Euler’s Law

The following equation is known as Euler’s law. e j  (cos  jsin)

Note that

cos   cos  even function sin   sin  odd function

77 Sine & Cosine Axioms

This implies that

e j  (cos  jsin)

This leads to two axioms:

e j  e j e j  e j cos  and sin  2 2 j

78 Complex Unit Vector Observe that e j represents a unit vector which makes an angle  with the positive x axis.

79 Third Order Butterworth Filter

Find the transfer function that corresponds to a third-order (n = 3) Butterworth filter. Solution: From the previous discussion:

jk/3 sk = e , k=0,1,2,3,4,5

80 S Values

Therefore, j0 s0  e j /3 s1  e j2 /3 s2  e j s3  e j4 /3 s4  e j5 /3 s5  e

81 Roots

The roots are:

p 1 p 1 1 6

p .5 0.8668j p .5 0.866j 2 5

p .5 0.866j p .5 0.866j 3 4

82 Filter Design Table

The factored form of the normalized Butterworth polynomials for various order n are tabulated in filter design tables.

83 Butterworth Filter Design Table

n Denominator of H(s) for Butterworth Filter 1 s + 1 2 s2 + 1.414s + 1 3 (s2 + s + 1)(s + 1) 4 (s2 + 0.765 + 1)(s2 + 1.848s + 1) 5 (s + 1) (s2 + 0.618s + 1)(s2 + 1.618s + 1) 6 (s2 + 0.517s + 1)(s2 + 1.414s + 1 )(s2 + 1.932s + 1) 7 (s + 1)(s2 + 0.445s + 1)(s2 + 1.247s + 1 )(s2 + 1.802s + 1) 8 (s2 + 0.390s + 1)(s2 + 1.111s + 1 )(s2 + 1.663s + 1 )(s2 + 1.962s + 1)

84 DIGITAL FILTERS

85 Digital Filter Design Parameters

86 http://cnx.org/contents/2YEHwQYh@1/FIR-FILTER-DESIGN-THE-WINDOW-D Digital Filter Design Parameters

 P  20log10 (1 P )dB

S  20log10 (s )dB P / 20  P 110 S / 20 S 10 P 2FP P   FT FT

S 2FS S   FT FT 87 http://cnx.org/contents/2YEHwQYh@1/FIR-FILTER-DESIGN-THE-WINDOW-D Analog-Based Digital Filters

88 Filter Order Estimation

Estimation of the Filter Order FIR(lowpass digital filter): 20log (   )13 N  10 p s 14.6(s  p ) / 2 For narrowband filter: N  20log10 (s )0.22 (s  p ) / 2 For wideband filter: 20log ( )5.94 N  10 p 27(s  p ) / 2

89 Filter Order Estimation Digital Signal Processing Filter Design: IIR

1. Filter Design Specifications 2. Analog Filter Design 3. Digital Filters from Analog Prototypes

90 Digital Filter Design 1. Filter Design Specifications

91 Digital Filter Design Performance Constraints

92 Digital Filter Design Performance Constraints

93 Digital Filter Design Passband Ripple

94 Digital Filter Design Stopband Ripple

95 Digital Filter Design Filter Type Choice : FIR vs. IIR

96 Digital Filter Design FIR vs. IIR

97 Digital Filter Design IIR Filter Design

98 Digital Filter Design 2. Analog Filter Design

99 Digital Filter Design CT Transfer Functions

100 Digital Filter Design Butterworth Filters

101 Digital Filter Design Butterworth Filters

102 Digital Filter Design Butterworth Filters

103 Digital Filter Design Butterworth Filters

104 Digital Filter Design Butterworth Example

105 Digital Filter Design Butterworth Example

106 Digital Filter Design Chebyshev I Filter

107 Digital Filter Design Chebyshev I Filter

108 Digital Filter Design Chebyshev I Filter

109 Digital Filter Design Chebyshev II Filter

110 Digital Filter Design Elliptical (Cauer) Filters

111 Digital Filter Design Analog Filter Types Summary

112 FILTER DESIGN

113 MATLAB for Signal Processing

Filter Design

The MathWorks Inc. Natick, MA USA

114 MATLAB for Signal Processing 115 Filter Design

• Frequency selective system • Analog • Digital – Infinite impulse response (IIR) M N y(n)  bm x(n  m)  ak y(n  k) m0 k1

– Finite impulse response (FIR) a=1

M y(n)  bm x(n  m) m0

Copyright  1984 - 2001 by The MathWorks, Inc. MATLAB for Signal Processing 116 Filter Design Methods

Filters

Continuous Discrete

IIR FIR

Butterworth Windowing Bilinear Analog Chebyshev I Equiripple prototyped Transformation filters Chebyshev II Least Squares Eliptic Arbitrary Response Bessel Yulewalk Raised Cosine

Copyright  1984 - 2001 by The MathWorks, Inc. MATLAB for Signal Processing 117 Filter Specification

• Wp, Ws, Rp, Rs Passband Ripple

Stopband Attenuation

Fs/2

Passband Transition Band Stopband Copyright  1984 - 2001 by The MathWorks, Inc. MATLAB for Signal Processing 118 FIR Filter Design • FIR –Features –Windowing Inverse FFT to get h(n) Arbitrary response –Other methods • Example b=fir1(20,0.5,hanning(21)); freqz(b,1)

Copyright  1984 - 2001 by The MathWorks, Inc. MATLAB for Signal Processing 119 Windowing • Finite data length • Functions • bartlett, blackman, boxcar, chebwin, hamming, hanning, kaiser, triang

1 1 • 0.9 0.9 0.8 0.8

0.7 0.7

0.6 0.6 • Example 0.5 0.5 0.4 0.4

0.3 0.3 0.2 0.2 x=hanning(N); 0.1 0.1 0 0 0 2 4 6 8 10 12 14 16 plot(hamming(32) 0 5 10 15 20 25 30 35 stem(kaiser(16,30)

Copyright  1984 - 2001 by The MathWorks, Inc. MATLAB for Signal Processing 120 Filter Design Tradeoffs

Reduced width of <==> Increased complexity transition band (higher order)

Lower Rp, Higher Rs <==> Increased complexity (higher order)

FIR IIR

Higher Order Lower Order

Always Stable Can be Unstable

Passband Phase Non-linear Phase Linear

Copyright  1984 - 2001 by The MathWorks, Inc. MATLAB for Signal Processing 121 Filter Design with FDATool Import filter Analysis method for coefficients or analyzing filter design design filter

Quantize current filter using Filter Design Toolbox

Set quantization parameters for Filter Design Toolbox

Type of filter to design and method to use Filter specifications

»fdatool Copyright  1984 - 2001 by The MathWorks, Inc. MATLAB for Signal Processing 122 Importing Existing Designs

Copyright  1984 - 2001 by The MathWorks, Inc. MATLAB for Signal Processing 123 Analyze Filters with FDATool

Copyright  1984 - 2001 by The MathWorks, Inc. MATLAB for Signal Processing 124 Print Preview and Annotation

Copyright  1984 - 2001 by The MathWorks, Inc. MATLAB for Signal Processing 125 Convenient Exporting from FDATool

Copyright  1984 - 2001 by The MathWorks, Inc. Digital Filter Design

126 Starting FDATool

Start MATLAB. At the command line, type in “fdatool”. The following screen will appear:

127 Designing an FIR Filter Design

From the “Design Method” part of the screen, click on the “FIR” box and select “Window”. Setting the Filter Coefficients Click on the “Design Filter” box when done.

128 Designing an FIR Filter

The frequency response curve of the filter will appear

It can be seen that for frequencies above 4 kHz, the output amplitude is reduced by more than 40 dB (100 times). 129 Designing an FIR Filter

Select File -> Save Session As… Give the filter a unique name such as “FIR_lowpass_800Hz”.

130 Designing a High Pass Filter The next step is to design a highpass filter. At the FDATool window, Select File -> New Session to start the new design.

131 The Highpass Filter Design

Set the “Response Type” to “Highpass”. Notice that the “Filter Specifications” part of the screen changes.

132 Entering the Filter Parameters

Click on the “Design Filter” box when done.

133 Viewing the Highpass Filter Frequency Response

Click on the “Design Filter” box when done.

134 Saving the Finished Highpass Filter Design

Select File -> Save Session As… and give it a unique name. “FIR Highpass 800Hz Hamming Window”.

135 PSPICE

136 What is Spice?

Spice is the short form of: Simulated Program with Integrated Circuit Emphasis

137 Why PSPICE Programming?

Don’t have to draw the circuit More control over the parts More control over the analysis Don’t have to search for parts Some SPICE software applications (HSPICE, etc.) don’t have GUI at all Quick and efficient

138 Steps of PSPICE Programming

Draw the circuit and label the nodes Create netlist (*.cir) file Add in control statements Add in title, comment & end statements Run PSPICE Evaluate the results of the output

139 MATLAB and SPICE Features

Features SPICE MATLAB Type of Circuit For small to very large small circuits Analysis circuits Frequency Yes Yes Response Inclusion of Device Model in Software Yes No Package

140 MATLAB and SPICE Features

Determination and No Yes plot of poles and Zeros Bulk Semiconductor No Yes Characteristics

pn junction No Yes characteristics - excluding I-v characteristics

141 PHASOR ANALYSIS

142 Continuity Conditions of Circuit Elements

The voltage across a cannot be changed instantaneously.   VC (0 )  VC (0 ) The current across an inductor cannot be changed instantaneously.   IL (0 )  IL (0 )

143 Time  Phasor

Current in phase

V = IR

Current lagging

V = jLI

Current leading

I = jCV

144 Resistor

V  R I

145 Instantaneous Response

146 Inductor

V  jL I

147 Current Lags Voltage in an Inductor

148 Capacitor

V 1  I jC

149 Current Leads Voltage in an Capacitor

150 Impedance in Series

Zab  Z1  Z2  Z3  ... 1 Z   R  jX Y Zeq  Z1  Z2  Z3  ... Complex Impedance Resistance, Reactance

151 Impedance in Parallel

Yab  Y1 Y2 Y3  ... 1 1 1 1 1 Y   G  jB    ... Z Z Z Z Z ab 1 2 3 Complex Conductance, Susceptance

152 Thevenin and Norton Transformation

153 Thevenin Equivalent Circuit

154 Norton Equivalent Circuit

155 Transformer

Z  R  jL  Z Vs  (Z s  R1  jL1 )I1  jMI 2 ab 1 1 r 2 2 0   jMI  (R  jL  Z )I  M 1 2 2 L 2 Z r  R2  jL2  Z L

156 Time differentiation replaced by  j Sinusoidal Ideal Transformer

v N i N 2  2 1  2 v1 N1 i2 N1 Power Conserved 1ST ORDER FILTER ANALYSIS

158 FigureFiltering 14.2 A circuit Circuit with voltage input and output.

159 response plots of the four types of filter circuits. (a)Filtering An ideal low Types-pass filter. (b) An ideal high-pass filter. (c) An ideal bandpass filter. (d) An ideal bandreject filter.

160 Figure 14.4 (a) A series RL low-pass filter.Low (b)-Pass The equivalent Filtering circuit Analysis at  = 0 and (c) The equivalent circuit at  = .

161 MagnitudeFigure 14.5 &The Phase frequency Responses response plot for the series RL circuit in Fig. 14.4(a).

162 LRFigureTransfer 14.6 The Function s-domain Analysisequivalent for the circuit in Fig. 14.4(a).

163 LowFigure-Pass 14.7 PassiveA series RCRC lowCircuit-pass filter.

164 RCFigureTransfer 14.8 The Function s-domain equivalentAnalysis for the circuit in Fig. 14.7.

165 Figure 14.9 Two low-pass filters, the Lowseries-Pass RL and Transfer the series RCFunctions, together with their transfer functions and cutoff frequencies.

166 First Order Low-Pass RC Passive Filter

Passive low-pass filter with cut-off frequency

167 HighFigure- Pass14.10 FilteringA series RC Analysis high-pass filter; (b) the equivalent circuit at  = 0; and (c) the equivalent circuit at  = .

168 MagnitudeFigure 14.11 &The Phase frequency Responses response plot for the series RC circuit in Fig. 14.10(a).

169 CR TransferFigure 14.12 Function The s-domain Analysis equivalent of the circuit in Fig. 14.10(a).

170 HighFigure- Pass14.13 PassiveThe circuit RL for ExampleCircuit 14.3.

171 RL TransferFigure 14.14 Function The s-domain Analysis equivalent of the circuit in Fig. 14.13.

172 First-Order Filter Circuits

High Pass Low Pass

R R VS + Low VS + High – C Pass – L Pass

GR = R / (R + 1/sC) HR = R / (R + sL)

GC = (1/sC) / (R + 1/sC) HL = sL / (R + sL)

173 2nd ORDER FILTER ANALYSIS

174

Mechanical Analogy Wikipedia.com

Automobile: Mass  inductor Suspension: Spring  capacitor Shock Absorber: Damper  resistor

Force  voltage Velocity  current

175 Series RLC Circuit

L

+ i(t) V (t) R S - C

KVL:

VL + VR + VC = Vs 176 Series RLC Circuit Equations

vL (t)  vR (t)  vC (t)  vS (t) t di 1 L  iR  i(t)dt  v (0)  v (t) dt C  C S 0 d 2i di i(t) dv L  R   0  S dt 2 dt C dt d 2i R di i(t) 1 dv    S dt 2 L dt LC L dt 177 Series RLC Circuit Equations d 2i R di i(t) 1 dv    S dt 2 L dt LC L dt 2 d i di 2 1 dvS  2  0 i(t)  dt 2 dt L dt R 1 ...where   and   . 2L 0 LC

Find thenatural response : vS  0 d 2i di  2   2i(t)  0 2 0 178 dt dt Series RLC Circuit Equations

d 2i di  2  2i(t)  0 dt 2 dt 0 try a solution in the form : i(t)  kest substituti ng : 2 st st 2 st s ke  2ske 0 ke  0 giving : 2 2 s  2s 0  0 Use the quadratic equation :

2 2  2  (2)  4(1)0 2 2 s      0 179 2(1) Natural Overdamped Case

R 1 Case 1 - Overdamped: >  large R: > o 2L LC

2 2 s1     0  0

2 2 s2     0  0 The natural response is two decaying exponentia ls :

s1t s2t in (t)  K1e  K2e

180 Natural Underdamped Case

R 1 Case 2 - Underdamped:   small R:  o 2L LC

2 2 2 2 2 2 s1     0    1 0     j 0 

2 2 2 2 s2     0    j 0  The natural response is two decaying

s1t s2t in (t)  K1e  K2e

2 2 2 2 t j( 0  )t t  j( 0  )t  K1e e  K2e e t 2 2  Ke cos(nt )...where n  0 

181 Natural Critically Damped Case

R 1 Case 3 - Critically damped:  :  o 2L LC

2 2 s1     0    0

2 2 s2     0  0    0 The natural response is t t in (t)  K1e  K2te

182 NaturalOverdamped Response: SeriesCase RLC

Assumed initial conditions : i0  I (1a)  0  1 0 vC 0  idt  V0 (1b)  C  Applying KVL gives di 1 t Ri  L  idt  0 (2) dt C  d 2i R di i     0 (3) d 2i R di i dt 2 L dt LC    0 dt 2 L dt LC (1) and (2) gives Initial conditions : di(0) Ri(0)  L V  0 i0  I 0  0 dt di(0) 1    RI V di(0) 1   0 0  183    RI V  (4)  dt L dt L 0 0 Natural Response: Series RLC

d 2i R di i    0 2 dt 2 L dt LC R  R  1 s1       Initial conditions : 2L  2L  LC 2 i0  I0 R  R  1  s     di(0) 1 2      RI V  2L  2L  LC  dt L 0 0

 2 2 st s      Natural Let i  Ae : A and s are constants  1 0 s     2  2 frequencies AR A  2 0  As2est  se st  est  0  R L LC    2L factor st  2 R 1  where  Ae  s  s    0  1 Resonant  L LC     0 LC frequency R 1 Characteristic   s2  s   0 184 L LC equation Natural Solution: Series RLC

2 2 s      Two solutions (if s1  s2 ) :  1 0 2 2 i  A es1t , i  A es2t s2     0 1 1 2 2  R    where 2L A general solution :  1  s1t s2t 0  i(t)  A e  A e  LC 1 2 • Three cases discussed

– Overdamped case :  > 0

– Critically damped case :  = 0

185 – Underdamped case :  < 0 Natural Response: Parallel RLC

Assumed initial conditions :  1 0 i0  I0  v(t)dt (1a)  L  v0  V0 (1b) Applying KCL gives v 1 t dv  vdt  C  0 (2) R L  dt 2 2 2 d v 1 dv v s1,2     0  2    0 (3) dt RC dt LC  1 st   Let v(t) Ae ,  2RC where  the characteristic equation becomes 1 0  1 1  LC s2  s   0 186 RC LC Natural Response: Parallel RLC

• Overdamped case :  > 0

s1t s2t v(t)  A1e  A2e

• Critically damped case :  = 0 t v(t)  A1  A2te

• Underdamped case :  < 0

s1,2    jd

2 2 where d  0  v(t)  et A cos t  A sin  t 187 1 d 2 d Summary: Series & Parallel RLC

• Series RLC Circuit • Parallel RLC Circuit

2 2 2 2 s1,2     0 s1,2     0  R  1       where 2L where 2RC  1  1 0   0   LC  LC Initial conditions : Initial conditions : i(0)  I v(0)  V  0  0 di(0) V0  RI0  dv(0) V0  RI0        188  dt L  dt RC Step Response: Series RLC

Applying KVL for t > 0, di Ri  L  v  V (1) dt S dv But i  C dt 2 d v R dv v VS  2    (2) dt L dt LC LC v(t)  vt (t)  vss (t) where (2) has the same form as vt : the transient response in the source- free case.  vss : the steady -state response

189 Step Response: Series RLC

d 2v R dv v V   S  0 dt 2 L dt LC ' Let v  v VS , d 2v' R dv ' v'     0 dt 2 L dt LC The characteristic equation becomes R 1  s2  s   0 L LC Same as in the source- free case. 190 Step Response: Series RLC

 v(t)  vt (t)  vss (t)

vss (t)  v()  VS

s1t s2t (Overdamped) A1e  A2e  t (Critically damped) vt (t)  A1  A2te  t (Underdamped) A1 cosd t  A2 sin d te

where A1,2 are obtained from v(0) and dv(0)/dt.

191 General Response

192 Step Response: Parallel RLC

Applying KCL for t > 0, v dv  i  C  I (1) R dt S di But v  L dt d 2i 1 di i I     S (2) dt 2 RC dt LC LC i(t)  it (t)  iss (t) where (2) has the same form as it : the transient response in the source- free case.  iss : the steady -state response

193 Step Response: Parallel RLC

d 2i 1 di i  I   S  0 dt 2 RC dt LC ' Let i  i  I S , d 2i' 1 di ' i'     0 dt 2 RC dt LC The characteristic equation becomes 1 1  s2  s   0 RC LC Same as in the source- free case. 194 Step Response: Parallel RLC

 i(t)  it (t)  iss (t)

iss (t)  i()  I S

s1t s2t A1e  A2e (Overdamped)  t (Critically damped) it (t)  A1  A2te  t (Underdamped) A1 cosd t  A2 sin d te

where A1,2 are obtained from i(0) and di(0)/dt.

195 Second-Order Filter Circuits

Band Pass Z = R + 1/sC + sL

R HBP = R / Z Low C Pass V + Band S HLP = (1/sC) / Z – Reject High L HHP = sL / Z Pass

HBR = HLP + HHP

196 SecondFirst- OrderOrder FilterLow-Pass Circuits Filter

 j  j

ZC 2fC 2fRC Vout  Vin  Vin  Vin Z  Z  Z j 2f L  f 1  R L C R  j2fL  1 j 0    2fC   R  f0 2ff 0LC   j V 2fRC  jQ ( f / f ) out  H ( f )   S 0 V 2f L  f 1   f f  in 0    0  1 j    1 jQS    R  f0 2ff 0LC   f0 f  197 Low-Pass Filter: Natural Frequency Second-Order Low-Pass Filter

V  jQ  f f  H  f   out  s 0 Vin 1 jQs  f f0  f0 f  Q  f f   90  s 0 2 2 1 1 QS  f f0  f0 f  Tan Qs  f f0  f0 f  Q  f f  H  f   s 0 2 2 1 QS  f f0  f0 f 

198 Low-PassFirst -Filter:Order FilterNatural Circuits Frequency

199 High-PassSecond Filter: Order NaturalHigh-Pass FilterFrequency

At low frequency the capacitor is an open circuit At high frequency the capacitor is a short and the inductor is open

200 Band-PassSecond Filter: Order BandNatural-Pass FilterFrequency

At low frequency the capacitor is an open circuit At high frequency the inductor is an open circuit

201 Band-RejectSecond Filter:Order Band Natural-Reject Filter Frequency

At low frequency the capacitor is an open circuit At high frequency the inductor is an open circuit

202 Series RLC Bandpass Filter Design

Design a series RLC bandpass filter with cutoff frequencies f1=1kHz and f2 = 10 kHz. Cutoff frequencies give us two equations but we have 3 parameters to choose. Thus, we need to select a value for either R, L, or C and use the equations to find other values. Here, we choose C=1μF. f1=1kHz  1 = 2f1 = 6280 rad/s f2 = 10 kHz  2 = 2f2 = 62,800 rad/s

012  0  1  2 (6280)(62800)  19,867rad/s  f 0 3162.28Hz o 2 11 1 L    2.533 mH 0  2 2 6 LC o C 2 (3162.28) (10 )

  19,867rad/s Q  0 Q 0   0.3514 21 21 (2  *10000 2  *1000)rad/s

L LLL1 3 R 0    L 2.533(10 ) 2 R   143.24  203 QQCQCQLC CQ2(10 6 )(0.3514) 2 ACTIVE FILTER DESIGN

204 First Order Low-Pass Active RC Filter

V Z H ( f )  o   f Vi Zi 1 1 1 1 j2fR C     f f Z f R f 1 R f R f j2fC f

R f Z f  1 j2fR f C f Z  R  1 f  f  H ( f )      Zi  Ri 1 j2fR f C f  R  1   f       Ri 1 j( f / f B )  1 f B  2R f C f

A low-pass filter with a dc gain of -Rf/Ri 205 Integrator Circuit

1 t v t   v t dt o    in   RC 0 206 First Order High-Pass RC Passive Filter

v Z H ( f )  o   f vi Zi 1 Zi  Ri  Z f  R f j2 f Ci Z R H ( f )   f   f Zi 1 Ri  j2 f Ci

j2 f R f Ci  Ri  j2 f R f Ci      1 j2 f RiCi  Ri 1 j2 f RiCi

 R f  j( f / fB )       Ri 1 j( f / fB ) 1 fB  2 RiCi

A high-pass filter with a high frequency gain of -Rf/Ri 207 Differentiator Circuit

dv v t  RC in o dt 208 Higher Order Active Filters

H ( f )  H1( f )H2 ( f )Hn ( f ) n n n  R f   1   (1)      Ri  1 j( f / fB )

209 Butterworth Transfer Function

Butterworth filters are characterized by having a particularly flat pass-band.

H H f   0 2n 1  f f B  210 First Order Low-Pass RC Active Filter

C

Zf R2 R1 Zi + + + +

vi + vo vi + vo

1  Z f  R ||    H(s)   2 sC  K c Zi R1 s c

R2 1 K  c  R1 R2C

211 Useful Active Circuits

Non-Inverting Op Amp: gain = (1 + Rf / R1) Inverting Op Amp: gain = (- Rf / R1)

Rf + R1 vo vi - + R f v R1 vi o -

Voltage Follower: gain = 1

+

vi vo -

212 Other Useful Active Circuits

The summing amp: The differential amp:

R R f vi1 1 R2 - R1

+ + R2 vi2 vo vi1 - R 1 + vo RN vi2 R2 -

viN

R2  Rf Rf Rf  v  v  v v   v  v  v  o  i2 i1 o i1 i2 iN R1  R1 R2 RN 

213 First Order Filter Functions

214 Second Order Filter Functions

215 Second Order Filter Functions

216 AC Analysis

Second-Order High-Pass Filter

Vin 1 0 AC 10V Rf 1 2 4.0 Cf 2 3 2.0uF Lf 3 0 127uH .AC DEC 20 100Hz 1MEG .PROBE .END

217

THANK YOU

PART of this document’s CONTENT is NOT ORIGINAL. Its ORIGINATION is from many FRIENDLY SOURCES. THANKS to ALL the sources used for the composition of this document. WE are TRULY INDEBTED to YOU. http://www.ece.uprm.edu/~domingo/

220