Frequency Response of a Physical and Simulated Lowpass Filter

advertisement
Frequency Response of a Physical and
Simulated Lowpass Filter
Nate Stutzke
April 9, 2001
1
Introduction
2
This report is an investigation of the frequency response of a physical and simulated lowpass filter. The
3
simple RC circuit seen below in Figure 1 was first modeled in Matlab, then physically constructed in an
4
electronics lab.
5
6
7
8
9
10
11
12
13
Fig. 1: RC Lowpass Filter
14
15
16
Theory, Procedure, and Results
17
With the use of Kirchoff’s Voltage and Current Laws the lowpass RC filter in Figure 1 can be described by
18
the differential equation
19
(Eq. 1) y (t ) + RC
dy (t )
dy (t )
1
1
= x(t ) or
+
y (t ) =
x(t ) .
dt
dt
RC
RC
20
Since this system is linear and time invariant (LTI) we know that if the input has complex exponential
21
form, then the output will be a scaled and shifted complex exponential. The frequency response of the
22
system, H(jω), is responsible for the scaling and shifting of the output. Restated, if x (t ) = e
23
y (t ) = H ( jω )e jωt . Plugging these values of x(t) and y(t) into the differential equation above and
24
solving for the frequency response gives
25
(Eq. 2) H ( jω ) =
jωt
, then
1
.
1 + CRjω
26
The Fourier Transforms of the input (X(jω)) and the output (Y(jω)) are related to the frequency response
27
(H(jω)) by
28
(Eq. 3)
Y ( jω ) = X ( jω ) H ( jω ) .
29
The magnitudes and phases of the input, output, and frequency response are related by the following
30
equations:
31
(Eq. 4) | Y ( jω ) |=| X ( jω ) || H ( jω ) |
32
(Eq.5)
∠Y ( jω ) = ∠X ( jω ) + ∠H ( jω )
33
2
1
The characteristics of the frequency response given in Equations 2 through 5 can easily be observed by
2
simulating the circuit using Matlab, and by physically constructing it in a circuits lab. As seen in Figure
3
1, the circuit components used in simulation and construction were a 47kΩ resistor and a 2.2µF capacitor.
4
The “lsim” command was utilized to simulate the output of the RC circuit in Matlab. The response of the
5
physical circuit was observed by monitoring the input and output with an oscilloscope.
6
7
For the simulated circuit, we began by observing the response to a 5Hz, 10Vpp sinusoid. At 5Hz (ω=10π)
8
Equation 2 gives H ( j10π ) = 0.294e
9
should have a magnitude of 0.294 * 10Vpp = 2.94Vpp, and it should have a phase of –1.272 radians. The
10
− j1.272
. Equations 4 and 5 tell us that the output of the circuit
input and output of the simulated circuit are shown below in Figure 2.
11
12
13
Fig. 2: Simulated RC Circuit Response
14
15
By visual inspection of Figure 2 it appears that the magnitude of the output is somewhere around 3Vpp as
16
expected. To get an exact value we used Matlab “max” command. This gave a value of 2.92Vpp, very
17
close to the predicted value. Visual inspection also shows a time delay of about –0.4 seconds which
18
translates to a phase of –1.26 radians. Using the Matlab “angle” command to find the exact phase gives a
19
value of –1.72 radians, exactly as predicted.
20
21
In the circuits lab, we physically constructed the lowpass RC filter in Figure 1. We began by examining the
22
response to a 5Hz, 5Vpp sinusoid. As in the simulation, theory predicts the frequency response
23
H ( j10π ) = 0.294e − j1.272 . The output should again have a phase of –1.272 radians. This time the
24
magnitude of the output should be 0.294 * 5Vpp = 1.47Vpp.
3
1
Figure 3 below shows the input and output of this physical lowpass filter. The yellow sinusoid represents
2
the input whereas the green represents the output.
3
4
5
Fig. 3: Physical RC Circuit Response
6
7
Measurement tools on the oscilloscope gave an output magnitude of about 1.5Vpp. This is within 2.0% of
8
the predicted value. Using the movable markers we estimated a phase of about –1.26 radians. This is
9
within 0.9% of the predicted value.
10
11
We also examined the response of the lowpass filter to 10Hz and 20Hz, 5Vpp sinusoids. Their responses
12
are shown below in Figures 4 and 5.
13
14
15
16
17
18
19
20
21
22
23
24
Fig. 4: Response to 10Hz Sinusoid
Fig. 5: Response to 20Hz Sinusoid
25
4
1
The data for these responses is summarized in Table 1 below.
5Hz
10Hz
20Hz
2
Theor. |H(jw)|
0.294
0.152
0.0767
|Vin|
5.06
5.05
5.05
|Vout| |Vout|/|Vin|=|H(jω)|
1.50
0.296
0.83
0.164
0.44
0.087
% Diff. Theor. ∠ H(jω) Exp. ∠ H(jω)
0.8%
-1.272
-1.26
8.1%
-1.418
-1.37
13.6%
-1.494
-1.46
%Diff.
0.9%
3.4%
2.3%
Table 1: Frequency Response Results for Physical Lowpass Filter
3
4
Another way to characterize the frequency response of this circuit is by examining the fast Fourier
5
transforms (FFT) of the input and output. The peaks in the FFTs should occur at the frequencies of the
6
input and output, both 5Hz in this case. The magnitudes of the input and output peaks are again related by
7
the magnitude of the frequency response. The ratio of the magnitude of the input peak to the magnitude of
8
the output peak should equal the magnitude of the frequency response.
9
10
In the Matlab simulation we only inspected the output of the simulated circuit. Using the “fft” command
11
gives the FFT shown in Figure 5 below. As expected the peak is located at 10π rad/sec (5Hz).
12
13
Fig. 6: FFT of Simulated Output
14
15
16
With the physical lowpass filter we analyzed the input and output FFTs. This was done using the built-in
17
FFT function on the oscilloscope. Figure 7 on the following page shows the FFT of the 5Hz sinusoidal
18
input. The largest peak was at 5Hz as expected. This peak had an amplitude of 17.86dB.
19
20
5
1
2
Fig. 7: FFT of 5Hz Input
3
4
Figure 8 below shows the FFT of the output of the physical lowpass filter. The largest peak was again at
5
5Hz as expected. The largest peak had an amplitude of 7.14dB.
6
Fig. 8: FFT of 5Hz Output
7
8
The magnitude of the frequency response of the physical lowpass filter can be calculated by examining the
9
amplitudes of the previous FFTs. If we convert the amplitude of the peaks to linear scale, the ratio of the
10
output peak magnitude to the input peak magnitude should equal the magnitude of the frequency response.
11
(Note: we must take the square root of this ratio because the magnitudes obtained with the oscilliscope are
12
for the power spectrum, not amplitude spectrum.) Doing this for the 5Hz input gives a value of 0.291.
13
This is within 0.3% of the expected magnitude of the frequency response. We repeated this process for the
14
10Hz and 20Hz inputs. This data for the FFT analysis at all three frequencies is located in Table 2 on the
15
following page.
16
6
Theor. |H(jw)|
|FFTin|
5Hz
0.294
17.86
7.14
0.291
1.0%
10Hz
0.152
17.88
1.15
0.146
3.9%
20Hz
0.0767
17.9
-5.96
0.0641
16.4%
1
|FFTout| √(|FFTout|/|FFTin|) % Diff.
Table 2: FFT Results for Physical Lowpass Filter
2
3
To observe the general frequency response of this filter, we let the input be noise generated by a function
4
generator. This input signal is a mixture of all frequencies. Figure 9 below shows the FFT of the input
5
(purple) and the output (pink) for this setup. The picture shows a drop in output magnitude as frequency
6
increases. This is expected behavior since the circuit is a lowpass filter.
7
8
9
Fig. 9: FFT of Noise Input/Output
10
11
12
Conclusion
13
We have successfully shown that | Y ( jω ) |=| X ( jω ) || H ( jω ) | first by simulating the circuit with
14
Matlab, then by constructing it in a lab. The magnitude of the frequency response for the system decreases
15
as frequency increases, thus the magnitude of the output decreases as frequency increases. This is why the
16
circuit is called a lowpass filter. It lets low frequencies pass, while it filters out higher frequencies.
17
18
One interesting trend that was observed was a decrease in accuracy as frequency increased. In general,
19
|H(jω)| was larger than predicted. As frequency increased, the experimental value got further (on high side)
20
from the theoretical value. This is likely due to the fact that the physical filter is not ideal. It is not able to
21
filter out higher frequencies as well as theory suggests. This is the case in many situations when going
22
from theory to reality.
7
Download