Lab 3: Continuous-Time Filter Design and Analysis Files necessary to compute this assignment: clean.wav, noisy.wav Equipment necessary to compute this assignment: A lter board that can be checked-out from the stockroom (do not check out until you need it), resistors (1: 29 k, 6: 16 k, 1: 68 k, 1: 24 k, and any others needed for your nal design), and capacitors (1: 0.001 F, 2: 0.01 F, and any others needed for your nal design). Introduction Many traditional analog circuits are designed through the principles of Fourier analysis. Common types of analog circuits are lowpass lters, highpass lters, bandpass lters, bandstop lters, and allpass lters. Lowpass lters remove high frequency content from a signal. Highpass lters remove low frequency content from a signal. Bandpass lters retain small sections (bandwidths) of frequencies and remove all other frequency content. Bandstop lters remove small sections (bandwidths) of frequencies and retain all other frequency content. Allpass lters distort signals while not aecting the magnitude response of the signal. In this lab, we will focus on developing lowpass analog lters. These lters are frequently used in systems to remove high frequency noise and aliasing eects. Specically, we will design and build a lowpass lter with operational ampliers (op-amps). We will use this lowpass lter to remove noise from a music signal. This lab assignment has three learning objectives: 1. To analyze a complex op-amp lter design using continuous-time Fourier analysis 2. To design a op-amp lter for a specic noise removal application 3. To experimentally build that design with op-amps and test its eectiveness Your experiment will be divided into three parts. In your lab report, you should address each part in separate subsections. See the lab report guidelines on the class website for more information. Deliverables This lab assignment has three deliverables: 1. One (1) lab report (see the Lab Report Guidelines on how to write it) 2. One (1) name processed.wav le with your digitally ltered version of name processed.wav 3. One (1) demonstration of you analog lter system to your lab instructor Please submit a hard copy of the paper deliverables and e-mail the electronic deliverables to your lab instructor before your assigned lab session between Nov. 18th Nov. 24th. 1 Part 1: Analyzing a high-order lter system In this part of the lab, we will analyze lter system with operational ampliers (op-amps) and continuous-time Fourier analysis. First, we will analyze a bi-quad lter systems, which is based on an collection of inverting op-amp systems. We will then analyze a rst-order noninverting low-pass lter system. Finally, we will combine one rst order noninverting low-pass lter system with two bi-quad lter systems. This is the system that will experimental with in the rest of the lab. In this part lab, you will use MATLAB to analyze the low-pass lter system and bi-quad lter systems. In the next section, we will experimental validate your analysis. Analyzing inverting op-amp systems: The inverting op-amp system: + Z2() x(t) y(t) Z1() x(t) Z1() Z2() y(t) Figure 1: An inverting op-amp circuit (left) and it block diagram representation (right) The op-amp realization as shown in Figure 1 is of an inverting amplier. The transfer function of the inverting amplier is dened by H() = Y () X() = Z1() Z2() . If you are familiar with impedances in terms of s, i.e. Z1(s) and Z2(s), assume s = j. On the left side of Figure 1, we see the circuit diagram for the inverting amplier. On the right side of Figure 1, we see the equivalent block diagram system representation of the operational amplier system. We will use these block diagrams to simplify our lter representations when build a bi-quad lter from inverting amplier circuits. In the following sections, we will analyze specic realizations of the inverting amplier. These realizations will gradually lead to building a bi-quad lter system. Analyzing analog lters in MATLAB: Throughout this lab, we will be analyzing analog lters. We will want to plot their transfer function magnitude and phase characteristics. We will do this using the MATLAB function freqs(num, den). When given no output, freqs plots the magnitude and phase of the transfer function is with numerator num(1)sN+num(2)sN1++num(N-1)s+num(N) and denominator den(1)sM + den(2)sM1 ++ den(M-1)s + den(M), where N = length(num) and M = length(den) and s = j. 2 A classic inverting op-amp system: + R2x (t) y(t) R1 x(t) R1 R2 y(t) Figure 2: An classic inverting op-amp circuit (left) and it block diagram representation (right) For the inverting op-amp system in Figure 1, when Z1() is a resistor R1 and Z2() is a resistor R2, we have an inverter. This is shown in Figure 2. In the frequency domain, the transfer function for this system can be expressed as H() = Y () X() = R1 R2 . MATLAB Exercise: Let R1 = 16 k and R2 = 16 k. Use the MATLAB function freqs (with no outputs and s = j) to analyze this circuit and its transfer function H(). An integrator system: + R4x (t) y(t) C3 x(t) 1 jR4C3 y(t) Figure 3: An integrator op-amp circuit (left) and it block diagram representation (right) In Figure 1, when Z1() and Z2() represents a resistor and capacitor, respectively, we generate an inverting integrator. This is shown in Figure 3. We call this system an inverting integrator because the input-output relationship for the system (assuming x(0) = 0) is y(t) = 1 R4C3Zt1 0 x()d . The time-domain impulse response h(t) and the frequency-domain transfer function H() of the integrator system is given by h(t) = 1 R4C3 u(t) , H() = Y () X() = 1 jC3 R4 = 1 jR4C3 MATLAB Exercise: Let C3 = 0.01 F and R4 = 16 k. Use the MATLAB function freqs (with no outputs and s = j) to analyze this circuit and its transfer function H(). 3 An integrator system with decay: + R8x (t) y(t) R7 C7 x(t) R7 R8(1 + jR7C7) y(t) Figure 4: An integrator with decay op-amp circuit (left) and it block diagram representation (right) In Figure 1, when Z1() and Z2() represents a resistor and a parallel resistor-capacitor, respectively, we generate an inverting integrator with decay. When integrating, this system adds recent values with greater weight than older values. The time-domain impulse response h(t) and the frequency-domain transfer function H() of the integrator with decay system is given by h(t) = 1 R8C7 e1/(R7C7)u(t) , H() = Y () X() = R7 R8(1 + jR7C7) . MATLAB Exercise: Let R7 = 68 k, C7 = 0.01 F, and R8 = 1 k. Use the MATLAB function freqs (with no outputs and s = j) to analyze this circuit and plot its transfer function H(). A summation system: + Z3() x2(t) Z2() x1(t) y(t) Z1() x1(t) Z1 2 () P Z1() y(t) Z1 3 () x2(t) Figure 5: An summation op-amp circuit (left) and it block diagram representation (right) In Figure 1, when a new input is added with input impedance Z3(), we generate summation system. This is shown in Figure 5. A summation system allows us to add multiple inputs together. The frequency-domain transfer function H() of the summation system is given by Y () = Z1()X1() Z2() + X2() Z3() . 4 Combining systems: In this previous subsections, we analyzed fundamental inverting amplier circuits. Now we will demonstrate how to combine these circuits together through system analysis and the properties of the Fourier trasnform. A cascaded system: x(t) H1() H2() y(t) Figure 6: A cascade system. Figure 6 shows a cascaded system where the output of one system become the input of the next. In Part 1 of the course, we learned that the time-domain impulse response of the overall system is given by the convolution of the two impulse responses. The frequency-domain transfer function of the overall circuit is given by the convolution property of the Fourier transform h(t) = h1(t)h2(t) F H() = H1()H2() . This implies that if we can easily combine our systems to build better lters by feeding the output of one lter into the input of the next. A feedback system: x(t) P H1() H2() y(t) Figure 7: A feedback system. Figure 7 shows a feedback system where the output overall system is manipulated and then added back to the input. In a feedback system, the system H1() is often known as the plant or process that modies a signal over time. The system H2() is often known as the controller that steers your output y(t) to a particular value. The frequency-domain transfer function for a feedback system is dened by H() = Y () X() = X()H1() + Y ()H1()H2() X() H() = H1() + H()H1()H2() H()(1H1()H2()) = H1() H() = H1() 1H1()H2() This shows that we can use the Fourier transform to analyze a rather complex process, such as a feedback. 5 A bi-quad lter system: + R8x (t) R7 C7 + R4 y(t) C3 + R2 R9 R1 x(t) H1() P H2() H3() H4()H 5() y(t) Figure 8: An bi-quad op-amp circuit (top) and it block diagram representation (bottom) Figure 8 shows a bi-quad lter. The top part of Figure 8 shows the circuit representation and the bottom part of Figure 8 shows the equivalent block diagram which corresponds to each of the circuits and properties discuss in the previous subsections. Use everything we previously learned about to derive the transfer function of this system. You will nd that the transfer function for the bi-quad circuit is dened as H() = (R2R9R7/R8) R7R1 + R2R9(1 + jR7C7)R4C3j Furthermore, this can be simplied into the form H() = K2 c 2 + jBc + A2 c where K = (R9/R8), 2 c = 1/(R4R9C3C7), Bc = 1/(R7C7), and A = R1/R2. MATLAB Exercise: Let R1 = 16 k, R2 = 16 k, C3 = 0.01 F, R4 = 16 k, R7 = 68 k, C7 = 0.01 F, R8 = 1 k, R9 = 1 k. Use the MATLAB function freqs (with no outputs and s = j) to analyze this circuit and plot its transfer function H(). Repeat this analysis for R1 = 16 k, R2 = 16 k, C3 = 0.01 F, R4 = 16 k, R7 = 24 k, C7 = 0.01 F, R8 = 1 k, R9 = 1 k. What changed? 6 A rst-order noninverting low-pass lter: + R1x (t) y(t) R2 R3 C1 Figure 9: A rst-order low-pass lter circuit (left) and it block diagram representation (right) Figure 9 shows a rst-order noninverting low-pass lter made with op-amps (note: the bi-quad lter system is a second-order lter). In our experimental setup, we use this system and two bi-quad lters. The frequency-domain transfer function for the rst-order noninverting low-pass lter is H() = 1 + (R3/R2) 1 + jR1C1 MATLAB Exercise: Let R1 = 29 k, R2 = 1 k, R3 = 1 k, and C1 = 0.001 F. Use the MATLAB function freqs (with no outputs and s = j) to analyze this circuit and its transfer function H(). Our experimental setup (putting everything together): x(t) First-order low-pass lter Bi-quad lter # 1 Bi-quad lter # 2 y(t) Figure 10: A block diagram of our complete lter system. Figure 10 illustrates the system we will be designing and testing throughout the rest of this lab. It consists of a rst-order low-pass lter in series with two bi-quad lters. When cascaded together, we build a 5th-order lter (one 1st-order lter and two 2nd-order lters). Use the properties you previously learned in this lab to derive the transfer function for the entire lter system in Figure 10. You may want to use the function tf in MATLAB to help you. MATLAB Exercise: For the rst-order non-inverting low-pass lter, let R1 = 29 k, R2 = 1 k, R3 = 1 k, and C1 = 0.001 F. For the rst bi-quad lter, let R1 = 16 k, R2 = 16 k, C3 = 0.01 F, R4 = 16 k, R7 = 68 k, C7 = 0.01 F, R8 = 1 k, R9 = 1 k. For the second bi-quad lter, let R1 = 16 k, R2 = 16 k, C3 = 0.01 F, R4 = 16 k, R7 = 24 k, C7 = 0.01 F, R8 = 1 k, R9 = 1 k. Use the MATLAB function freqs (with no outputs and s = j) to analyze this complete system and plot its transfer function H(). 7 Include in Lab Report Experimental Design Section: Include: A block diagram of your bi-quad lter similar to bottom plot of Figure 8, but with the transfer functions H1(), H2(), H3(), H4(), and H5() identied (in terms of resistances, i.e., R1, R2, etc., and capacitances, i.e., C3,C7). Include: A block diagram of the of the entire lter system, similar to Figure 10. Include in Lab Report Analytical Methods Section: Include: Your derivation of the bi-quad lter (using the other transfer functions and properties discussed in this lab). Include in Lab Report Results and Discussion Section: Include: Your MATLAB plots of the each bi-quad circuits transfer function. Include: Your MATLAB plot of the rst-order non-inverting low-pass lter circuits transfer function. Include: Your MATLAB plot of the entire systems transfer function Answer: With the given conguration, would you consider each of the stages (and the system as a whole) low pass lters? 8 Part 2: Validate your analysis Check out a customized lter board from the stockroom. The diagrams in Figure 11 and Figure 12 illustrate the circuit board that we will use. Note that some of the boards dier slightly from the diagram. To power the board, attach a +15 V line to the red input, attach a -15 V line to the blue input, and attach the ground to the green input. Before inputting a signal the board, verify your setup with your lab instructor. R1 C1 R1 R2 C3R4R7 R1 R2 C3R4R7 Figure 11: Block diagram of the circuit board. Figure 12: Block diagram of the circuit board. Our goal is to verify our analyses from part one. Collect the necessary resistors and capacitors specied at the end of Part I to build the system. Note that several capacitors and resistors are already on the board. Specically, R2 and R3 for the rst-order noninverting low-pass lter are already on the board. Also, C7 R8, and R9 for each of the bi-quad lters are already on the board. Place the remaining resistors and capacitors into the appropriate locations. Using the equipment available to you, measure the magnitude response of each block (the rstorder low-pass lter and each of the bi-quad lters). Measure the frequency responses by inputting sinusoids at dierent frequencies and measuring the amplitude of the response. Estimate the phase response by estimating the time lag between the input and output signals and converting the lag to radians. First measure the response for each stage separately and then measure the response for the entire system. 9 Plot the frequency response on log-log graphes for magnitude and phase similar to that generated by the freqs MATLAB function. You must have at least 20 measurements from 100 Hz to 20 kHz. Choose your frequencies so that they are uniformly (at least approximately) distributed on the log-log graph. Compare your measurements with the MATLAB plots results from Part I. Include in Lab Report Results and Discussion Section: Include: Your frequency response plots of the each bi-quad circuits transfer function. Include: Your frequency response plots of the rst-order non-inverting low-pass lter circuits transfer function/ Include: Your frequency response plots of the entire systems transfer function. Answer: Does your analysis from Part I match your experimental results? If not, why? Answer: Do these results illustrate a low pass lter? Is it a good low pass lter? What makes a lter good? 10 Part 3: Designing and implementing an analog lter Analyze the music: In this part of the lab, we will combined everything we previously learned to design our own analog lter and implement it with our lter board. Two pieces of music should be included with the lab. One le (clean.wav) is a clean segment of Christopher Tins Baba Yetu. The other le (noisy.wav) was obtained by adding noise to the clean signal. These digital signals are sampled at fs = 44100 samples/s. Our goal is to design an analog lter that will remove the noisy components from (noisy.wav). We will use clean.wav to determine the low frequency range containing all the signicant the components for the clean signal. Note that, in practice, we usually do not have the clean signal. In this case, however, the clean signal will help to design the best possible lter. Load clean.wav using the functions you learned in Lab 2. Estimate the frequency components of the clean signal with the power spectrum estimation function pwelch(x,hann(1024),512,2048,fs) with the parameters given above. This is similar to the fanalysis function used in Lab 2, but slightly more sophisticated. We will not get into the details in course (if you want to learn more, look up Welchs method). From the resulting plot generated by pwelch, identify a continuous range of frequencies for which the signal spectrum is within 20 dB of the frequency component with the maximum strength. This represents the dominate frequencies in the music. Design the analog lter: Using MATLAB and the freqs function, choose component values to design a lter (based on the 3-stage lter system we are using experimentally) that retains frequency components within the range of the music (determined in the previous subsection) and removes frequency components outside the range of the music. Try to make the best lter possible. Load noisy.wav using the functions you learned in Lab 2. To test your lter, run [numd,dend] = bilinear(num,den,fs); % Convert analog filter to discrete filter x_filtered = filter(numd,dend, x_noisy); % Implement discrete filter The rst function approximates our analog lter as a discrete lter (we cannot perfectly implement an analog lter in a computer). The second function performs the ltering. The variables num and den are the same as used for freqs. Use this code to test your custom lter on the noisy data in noisy.wav. You should be able to remove most of the noise and retain only the singing without distortion. Save a new wave le called name processed.wav with you ltered result. Implement the analog lter: Identify and retrieve the resistors and capacitors needed to implement the lter you designed with the lter board. Build your design. After Fall break, the lab instructors will have a portable music player with which you can test your lter. Listen to the noisy audio and the processed audio (processed with your lter) and verify if the noise levels are smaller for the processed signal than the original noisy signal. You should also listen for any change in the quality of the music itself because of the ltering (i.e. distortion). Remember that low-strength components in the audio signal will be removed by your lter. If necessary, make adjustments to the lter design and repeat the testing process. 11 Include in Lab Report Results and Discussion Section: Include: The power spectrum estimation plot from pwelch. Include: The frequency range containing the dominant frequency components in the clean music. Include: All the resistor and capacitor component values in your nal lter design. Include: A MATLAB plot of the frequency response (from freqs) for your designed lter. Answer: Does your nal lter introduce any distortions into the signal? Why or why not? Answer: Does your nal experimental system sound like your nal digital system? Explain. Submit: The .wav le name processed.wav, which contains your digitally ltered version of Baba Yetu. Demonstrate: When your lter design is nalized, present the nal result to your lab instructor who will grade it on ltering quality.
Programming
[Solved] SOLVED:Fundamentals of Signals and Systems
$25
File Name: SOLVED:Fundamentals_of_Signals_and_Systems.zip
File Size: 395.64 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.