ELEC 225L Circuit Theory I Laboratory Fall 2010 Lab #7: Construction and Test of Low-Pass Filters Pre-Lab Exercise In this lab exercise you will construct the low-pass filter you analyzed in the previous lab session using the standard breadboard and using a printed circuit board. (Yes, you will get to do some soldering!) You will then test your circuits using a spectrum analyzer with a built-in tracking generator. In order to allow time for construction and measurements, you will be required to prepare a plot in Matlab before coming to lab. The low-pass filter circuit you analyzed using nodal analysis in Lab #6 is shown in Figure 1. L1 = 300 nH Rg = 50 v2 L2 = 300 nH iL C3 47 pF RL 50 v1 + vg + − vin C1 47 pF C2 150 pF + vL − − TEC of function gen. input port of analyzer Zeq Figure 1. Low-pass filter circuit. The function generator and load are incorporated into the spectrum analyzer that will be used to measure the circuit’s performance. Note that voltage vin is different from the Thévenin equivalent voltage vg. Your lab group’s assignment is to prepare a Matlab m-file that: 1. automatically plots the frequency response (gain in dB vs. frequency) of the filter generated via nodal analysis over the 1-200 MHz range in 1-MHz steps. You may ignore the DC case, and you may use your m-file from Lab #6 as a starting point. 2. imports measured frequency response data from a file in CSV (comma-separated values) format and plots the data on the same axes as the data obtained via nodal analysis. Use the Matlab “dlmread” command to import the data. The data file is available at the Laboratory page of the ELEC 225 web site. Details of these two tasks are given below. A frequency response is a plot of the ratio of load power to available input power (i.e., PL/Pin) vs. frequency. The power ratio (sometimes called the gain and represented by the variable G) is usually expressed in decibel form, which is a logarithmic representation of the ratio given by P G in dB 10 log L . Pin Note that the common logarithm is used. The Matlab function for computing common logarithms is “log10”, not “log.” The “log” command returns the natural logarithm; there is no “ln” command in Matlab. In the case of a filter the gain has a negative value at all frequencies because a signal passing through a filter can only lose strength, and therefore PL < Pin. That is, filters actually exhibit loss, not gain. Amplifiers, by contrast, have gain figures in dB that are positive. In Lab #6 you plotted the ratio of the load voltage magnitude to the generator voltage magnitude, |VL|/|Vg|, so you will need to modify your Matlab script for this week’s lab. Because the load is purely resistive, the power delivered to it is given by 2 2 1 1 VL* 1 VL VL * , PL Re VL I L Re VL * Re 2 2 RL 2 RL 2 RL where the asterisk (*) indicates complex conjugation. We have assumed that all voltages and currents are expressed in terms of their magnitudes, not their rms values. The available input power is that delivered by a source when its load (which includes the low-pass filter in this case) is conjugately matched to the source impedance (Thévenin equivalent impedance). Recall that this is the requirement for maximum power transfer. In the case of the low-pass filter circuit, maximum power transfer occurs when Zeq = Rg. Under matched conditions, Vin = 0.5Vg in Figure 1, so the available input power is Pin 0.5Vg 2Rg 2 Vg 2 8Rg , where again we have assumed that the voltages are expressed in magnitude form. Your Matlab script must calculate PL and Pin at each frequency from your nodal analysis results, calculate the gain in dB at each frequency, and plot the gain vs. frequency. Finally, your m-file must also import the sample measured frequency response (test) data in CSV format and use the “dlmread” command to store the data in a matrix. The filename supplied to the “dlmread” command must be enclosed in single quotation marks. You can examine the file yourself using any ASCII file editor (although Microsoft Notepad does not properly interpret the newline characters; use Wordpad or Excel instead). The frequency in Hz and the frequency response data in dB are in the second and third columns, respectively. These data will need to be extracted into two separate vectors so that they can be plotted along with the frequency response data generated by your nodal analysis routine. Note that the number of data points in the test data does not match the number of data points generated by the nodal analysis routine, so you can’t use the same frequency vectors for both curves. Use a black dashed line for the curve generated using nodal analysis and a black solid line for the measured response curve, respectively, and add a legend to identify the two curves. To help you check whether your m-file is working properly, a plot of the measured data only is shown on the next page. You will need to determine yourself whether your nodal analysis curve is correct. The use of bold face and large fonts in the plot is optional. 2 3