Response of an RC filter to a square wave the complex circuit response. Gim() ω Z2()ω Z1()ω...

5
9/17/2007 Miscellaneous exercises Filtered square wave 1 0 2 . 10 4 4 . 10 4 6 . 10 4 8 . 10 4 0.001 0.0012 0.0014 0.0016 2 1 0 1 2 Ft () sin Ω 0 t ( ) t Plot of the sum representing the square wave t 0 0.01 Ω fund , 10 Ω fund .. := The time scale of the problem is the inverse of the frequency Ω fund . This time scale is used to define a range of times for plotting: F t () Im 0 nmax n a n exp i Ω n t ( ) ( ) = := The imaginary part is used because we want to select the sine (not the cosine) and its harmonics. a n 2 π 2 2n 1 + := For the square wave, the amplitudes of the harmonics are: The square wave is then: Ω n 2n 1 + ( ) Ω fund := The fundamental frequency and its odd harmonics are: Ω fund 2 π 1000 := The fundamental frequency f that we will use is 1 kHz and the corresponding radian frequency is: n 01 , nmax .. := nmax 32 := The number of frequencies that we will consider is: The Fourier decomposition of the square wave can be found in mathematical tables. The frequencies and their amplitudes are given below. I. The square wave The experimenter often uses a square wave for timing and tiggering purposes. What happens to a square wave after passing through a low-pass filter? In this exercise we will express the square wave as the sum of a sine wave at the fundamental frequency and waves at the higher harmonics. Then we will use a circuit response function that attenuates and phase shifts each harmonic to find the new set of attenuated waves. The attenuated waves are then summed to find the waveform that comes out of the low-pass filter. The first example is a simple low-pass RC filter and the second example is a RLC bandpass filter. Response of an RC filter to a square wave:

Transcript of Response of an RC filter to a square wave the complex circuit response. Gim() ω Z2()ω Z1()ω...

Page 1: Response of an RC filter to a square wave the complex circuit response. Gim() ω Z2()ω Z1()ω +Z2()ω:= For a voltage divider with impedances Z 1(ω and Z 2(ω), the voltage division

9/17/2007 Miscellaneous exercises Filtered square wave 1

0 2 .10 4 4 .10 4 6 .10 4 8 .10 4 0.001 0.0012 0.0014 0.00162

1

0

1

2

F t( )

sin Ω0 t⋅( )

t

Plot of the sum representing the square wave

t 00.01Ωfund,

10Ωfund

..:=The time scale of the problem is the inverse of the frequency Ωfund.This time scale is used to define a range of times for plotting:

F t( ) Im

0

nmax

n

an exp i Ωn⋅ t⋅( )⋅( )∑=

⎡⎢⎢⎣

⎤⎥⎥⎦

:=The imaginary part is used because we want toselect the sine (not the cosine) and its harmonics.

an2π

22n 1+

⎛⎜⎝

⎞⎟⎠

⋅:=For the square wave, the amplitudes of the harmonics are:The square wave is then:

Ωn 2 n⋅ 1+( )Ωfund:=The fundamental frequency and its odd harmonics are:

Ωfund 2 π⋅ 1000⋅:=The fundamental frequency f that we will use is 1 kHz and the corresponding radian frequency is:

n 0 1, nmax..:=nmax 32:=The number of frequencies that we will consider is:

The Fourier decomposition of the square wave can be found in mathematical tables. The frequencies and their amplitudes are given below.

I. The square wave

The experimenter often uses a square wave for timing and tiggering purposes. What happensto a square wave after passing through a low-pass filter? In this exercise we will express thesquare wave as the sum of a sine wave at the fundamental frequency and waves at the higherharmonics. Then we will use a circuit response function that attenuates and phase shifts eachharmonic to find the new set of attenuated waves. The attenuated waves are then summed tofind the waveform that comes out of the low-pass filter. The first example is a simple low-passRC filter and the second example is a RLC bandpass filter.

Response of an RC filter to a square wave:

Page 2: Response of an RC filter to a square wave the complex circuit response. Gim() ω Z2()ω Z1()ω +Z2()ω:= For a voltage divider with impedances Z 1(ω and Z 2(ω), the voltage division

9/17/2007 Miscellaneous exercises Filtered square wave 2

The absolute value of the response function of the filter is:

100 1 .103 1 .104 1 .105 1 .1060

0.5

1

Gim ωplot( )

ωplot

ωplot 00.02R C⋅,

20R C⋅

..:=A range of frequencies for plotting is:

F t( ) Im

0

nmax

n

an Gim Ωn( )⋅ exp i Ωn⋅ t⋅( )⋅( )∑=

⎡⎢⎢⎣

⎤⎥⎥⎦

:=Note that the response function Gim(ω) goesinside of the summation.

The "im" indicates that we have used complex impedance toget the complex circuit response.

Gim ω( )Z2 ω( )

Z1 ω( ) Z2 ω( )+:=

For a voltage divider with impedances Z1(ω and Z2(ω), the voltage division ratio (gain Gim) is:

Ωfund 6.283 103×=Thus our filter easily passes the fundamental:

ω3db 2 104×=ω3db

1R C⋅

:=The 3 db point of this filter is:

R C⋅ 5 10 5−×=The time scale of interest is the RC time constant:

The corresponding impedances are: Z2 ω( ) 1i C⋅ ω⋅

:=Z1 ω( ) R:=

Farads C 0.05 10 6−⋅:=ohms R 1000:=

Our RC filter is shown in the diagram at the right. The values of the circuit components areR = 10 kΩ and C = 0.05 μF.

Vout Vin II. Square wave into an RC low pass filter:

Try it: What happens if the number of harmonics (nmax) in the sum is halved? Doubled?

The plot of the square wave was made using 1000 points on the time axis. If fewer points hadbeen used, the details in the square wave (at the "corners") would not have been plotted.

Page 3: Response of an RC filter to a square wave the complex circuit response. Gim() ω Z2()ω Z1()ω +Z2()ω:= For a voltage divider with impedances Z 1(ω and Z 2(ω), the voltage division

9/17/2007 Miscellaneous exercises Filtered square wave 3

The low-pass filtered square wave

0 2 .10 4 4 .10 4 6 .10 4 8 .10 4 0.001 0.0012 0.0014 0.00162

1

0

1

2

F t( )

t

Note that the filter has rounded the some (but not all) of the "corners" on the square wave. Thusthe low pass filter doesn't just "smooth" the curve. The effect of the filter is more complex.

Try it: How is the filtered wave changed if R is doubled? Halved?

III. Square wave into an RC high pass filter

This is really easy to do at this point because all that is necessary is to replace Z 1 with Z2 andvice versa.

Gim ω( )Z1 ω( )

Z1 ω( ) Z2 ω( )+:= Ntoe that the numerator is Z1 and not Z2.

F t( ) Im

0

nmax

n

an Gim Ωn( )⋅ exp i Ωn⋅ t⋅( )⋅( )∑=

⎡⎢⎢⎣

⎤⎥⎥⎦

:=

100 1 .103 1 .104 1 .105 1 .1060

0.5

1

Gim ωplot( )

ωplot

The absolute value of the response function of the filter is:

Page 4: Response of an RC filter to a square wave the complex circuit response. Gim() ω Z2()ω Z1()ω +Z2()ω:= For a voltage divider with impedances Z 1(ω and Z 2(ω), the voltage division

9/17/2007 Miscellaneous exercises Filtered square wave 4

ω 0.01 ω0⋅ 0.02 ω0⋅, 10 ω0⋅..:=

We will define a range of frequencies for plotting that go from 0.01 to 10 times ω0.

This frequency is much higher than the fundamentalfrequency of our square wave.

ω0 1 105×=ω0

1

C L⋅:=

The LC part of the circuit has a resonant frequency:

0.01 micro FaradsC 0.01 10 6−⋅:=

10 milli HenriesL 10 10 3−⋅:=

10 KΩR 10 103⋅:=

The circuit element values are: Vout

Vin The circuit at right is an RLC filter which has a response that is peaked at the resonant frequency. For this circuit, we canapply the same type of analysis that is used for the RC circuit.

IV. RLC bandpass filter

Try it: Why is the amplitude 2.0 for this wave and 1.0 for the square wave?

0 2 .10 4 4 .10 4 6 .10 4 8 .10 4 0.001 0.0012 0.0014 0.00162

0

2

F t( )

t

The high-pass filtered square wave

Page 5: Response of an RC filter to a square wave the complex circuit response. Gim() ω Z2()ω Z1()ω +Z2()ω:= For a voltage divider with impedances Z 1(ω and Z 2(ω), the voltage division

9/17/2007 Miscellaneous exercises Filtered square wave 5

The RLC circuit can be treated as a voltage divider with complex impedances.

The first impedance is simply: Z1 ω( ) R:=

And the second impedance is the parallel combination of L and C:

Z2 ω( ) 111

i C⋅ ω⋅

⎛⎜⎜⎝

⎞⎟⎟⎠

1i L⋅ ω⋅

⎛⎜⎝

⎞⎟⎠

+

:=

The gain that we defined above must beredefined with the new impedances: Gim ω( )

Z2 ω( )

Z1 ω( ) Z2 ω( )+:=

0 5 .105 1 .1060

0.5

1

Gim ω( )

ω

The absolute value of the complexresponse function has a peak at theresonant frequency of the LC part ofthe circuit:

The wave after passage through the filter is:

F t( ) Im

0

nmax

n

an Gim Ωn( )⋅ exp i Ωn⋅ t⋅( )⋅( )∑=

⎡⎢⎢⎣

⎤⎥⎥⎦

:=

The RLC filtered square wave

0 2 .10 4 4 .10 4 6 .10 4 8 .10 4 0.001 0.0012 0.0014 0.00160.2

0

0.2

F t( )

t

The plot shows that the transitions ("edges") of the square wave cause the LC part of thecircuit to oscillate at the resonant frequency.

Try it: Are the oscillations in the plot more or less heavily damped if the value of R is doubled?

Try it: Are the number of fast oscillations in one period of the sine wave equal to the numberthat you expect from comparing ω0 with Ωfund?