**Lab 5 - Frequency Response and Superposition** **[ENGR 12 Spring 2026](index.html)** (#) Objectives * Model the frequency response of second-order systems. * Create and analyze a bode plot. * Explain the principle of superposition and how it relates to filters. (##) Before you begin * Find your seat * [Section D](D5.pdf) - 4/15 * [Section C](C5.pdf) - 4/20 * [Section B](B5.pdf) - 4/22 * [Section A](A5.pdf) - 4/27 * Log into the desktop PC * Power up the oscilloscope (##) Resources * Reference the [pre-lab slides](lab5.pdf) as needed. * Download the [E12 lab report template](E12_Lab_Report_Template.zip) and upload it to Overleaf. Share it with your lab partner. Equipment manuals: * [MDO34 Oscilloscope](MDO34_Oscilloscope.pdf) * [AFG1022 Function Generator](AFG1022.pdf) Starter code: * [`lab_5_starter.m`](lab_5_starter.m) * [`load_tek_csv.m`](load_tek_csv.m) # Tasks ## Circuit setup 1. Collect an inductor, a decade resistor, and a decade capacitor to use at your workstation. 2. Connect a BNC splitter to the Channel 1 output of the AFG1022 function generator. 3. Connect one side of the splitter to Channel 1 on the MDO34 oscilloscope. 4. Connect the other side of the splitter to a BNC to banana plug adapter that will supply your circuit under test. 5. Build a series RLC circuit at your workstation whose voltage is supplied by the function generator. 6. Use a second BNC to banana plug adapter on Channel 2 of the MDO34 oscilloscope. Measure the voltage across the capacitor on Channel 2. 7. Ensure the oscilloscope is set to high res mode by pressing the button in the upper right. For this lab, you will use a [Butterworth filter](https://en.wikipedia.org/wiki/Butterworth_filter), which is characterized as a filter with the maximally flat passband and where the natural frequency of the circuit (called the cutoff frequency) is attenuated by half. For a series RLC low-pass filter, the natural frequency is $f_c = \frac{1}{2\pi\sqrt{LC}}$, and the damping ratio is $\zeta = \frac{R}{2} \sqrt{\frac{C}{L}}$. Set your resistor and capacitor values to achieve a cutoff frequency of your choice and a damping ratio of $\zeta = \frac{\sqrt{2}}{2}$ for the Butterworth response. !!! **Checkpoint:** Tell me or the Wizard the values you are using for your circuit components and the corresponding natural frequency and damping ratio of your circuit. ## Measure the frequency response of the filter 1. Calculate your filter's cutoff frequency using the equations above. 2. Select a number of frequencies at which to measure the system response. These frequencies should span a range that contains the cutoff frequency, and they should be evenly spaced in log space. I recommend at least 10 data points. !!! Tip You may find the MATLAB function `logspace` useful for selecting these frequencies. Also, I recommend limiting your data points to one order of magnitude above and below the cutoff frequency. 3. Configure the function generator to output a sine wave that is 1 V peak-to-peak, centered at 0 V, and at the lowest of the frequencies you selected. 4. Press the trigger knob to automatically set the trigger level. Press the vertical position knob to automatically center the wave on Channel 1 and Channel 2. 5. Configure the oscilloscope to measure the peak-to-peak voltage of Channel 2, the system response. Adjust the oscilloscope's two cursors such that one cursor is at the crest of the sine wave on Channel 1 and the other is at the crest of the sine wave on Channel 2 that is immediately next. Press the cursor adjustment knobs to toggle between coarse and fine control. 6. Record the frequency of the input, the peak-to-peak voltage of the output, and the time delay between the two cursors. 7. Repeat steps 3, 5, and 6 for each of the frequencies you selected. !!! **Checkpoint:** Show me or the Wizard your measurements for one frequency before taking all the measurements. ## Plot the frequency response of the filter 1. Download the starter code [`lab_5_starter.m`](lab_5_starter.m). 2. Input the component values for the resistor, inductor, and capacitor that you used. 3. Correct the transfer function in the starter code using your values for R, L, and C. 4. Run the starter code to see the theoretical bode plot for your system. 5. Add your experimental data to the bode plot following the example code. Your experiment should agree with the theory. !!! Tip You will need to convert the peak-to-peak voltage that you measured to a gain in dB and the time delay you measured into a phase offset in degrees. For the latter, use the formula $\phi = -360 * f * \Delta t$. !!! **Checkpoint:** Show me or the Wizard your bode plot before moving on. ## Filter a square wave Recall that a square wave is the sum of sine waves of odd harmonics. Review the [pre-lab slides](lab5.pdf) to refresh your memory. Analyze the bode plot of your system's frequency response. Then, configure the function generator to output a square wave whose fundamental frequency will pass (experience very little attenuation through the filter) but whose third, fifth, etc. harmonics will be greatly attenuated. Your circuit's output should look like a phase-shifted sine wave at the fundamental frequency. When you achieve that output, export a few periods' worth of data from your oscilloscope. !!! **Checkpoint:** Show me or the Wizard your output sine wave before moving on. ## Superposition analysis Write a MATLAB script that plots the input square wave from your recorded data and that square wave approximated as a weighted sum of five sine waves based on the Fourier series coefficients from the pre-lab slides. On the same plot, show the output data recorded from the oscilloscope and the same five sine waves shifted and scaled based on the theoretical system response for that frequency. If the square wave is the sum of those pure sinusoidal inputs, then the response to the square wave should be a sum of the individual responses. So says the principle of superposition. # Writing your lab report Write a lab report using $\LaTeX$ that adheres to the guidelines in the [E12 Lab Report Template](E12_Lab_Report_Template.zip). In addition to the guidelines in the template, below are guidelines specific to some sections of the report for this lab. (##) Introduction * Explain, in your own words, the purpose of today's lab. Be specific about exactly how the superposition principle and Fourier series allow us to predict the response of a linear system to a complex input waveform. (##) Theory * Derive the Fourier coefficients for the square wave. Make sure that you explain why $a_0$ is zero, why $a_n$ is zero for all $n$, and why $b_n$ is zero for even $n$ but equal to $4/(nπ)$ for odd $n$. This explanation will require at least some calculus in the form of definite integrals. (##) Methods * Create a schematic of your RLC circuit using Digi-Key Scheme-It. (##) Results * Make a table showing the data you collected for [Task 1.2](#toc1.2). Choose which columns to include. For example, you might tabulate the raw data with columns for frequency, peak-to-peak voltage, and time delay. Or you might tabulate processed data with columns for frequency, gain, and phase offset. * Calculate and report the RMSE between theory and experiment for both [Task 1.3](#toc1.3) and [Task 1.5](#toc1.5). (##) Discussion * Considering the effects of higher frequencies (e.g., 11th harmonic, 13th harmonic, etc.) might help approximate the original input square wave better, but we quickly reach a point of diminishing returns when approximating the low-passed response to the square wave. Why is considering higher frequencies less important for modeling the response to the square wave? * Describe any difficulties or challenges you had to overcome for the hardware and/or software parts of the lab. What were the tough parts and how did you overcome them? (##) Submission Two weeks from your lab meeting, please submit to Moodle: * Your lab report in PDF format. * All .csv data files you recorded from the oscilloscope. * Any code you wrote as .m files.