Lab #4: Transient Response of RC and RL Circuits
Department of Electrical and Computer Engineering
Spring 2026
Overview
The purpose of Lab 4 is to:
- Investigate and understand the transient response of RC and RL circuits
- Observe and measure the time constant concept using square wave excitation
- Compare experimental results with theoretical expectations
- Develop MATLAB analysis skills for processing experimental data
1. Prelab Assignment
1.1 Theoretical Review
Study the material at ECE Confidential, Cracking The Code: Circuits that Remember before proceeding.
1.2 RC Circuit Transient Response
The time constant ($\tau$) in RC circuits represents the time required for certain changes in voltages and currents to occur. After five time constants ($5\tau$), voltages and currents generally reach their final (steady-state) value.
For a series RC circuit:
- Charging voltage: $V_C(t) = V\!\left(1-e^{-t/RC}\right)$
- Discharging voltage: $V_C(t) = V_0\,e^{-t/RC}$
- Time constant: $\tau = RC$
where $V_C$ is the voltage across the capacitor, $V$ is the input voltage, and $V_0$ is the initial capacitor voltage before discharge. After four time constants ($4\tau$), the capacitor voltage reaches approximately 98% of its final value; this interval defines the transient response of the circuit.
Figure 1: Series RC circuit.
1.3 RL Circuit Transient Response
The time constant ($\tau$) in RL circuits similarly represents the time required for changes in voltages and currents to occur. The time constant is the equivalent inductance divided by the total series resistance, which includes the external resistor, the generator's internal resistance, and the winding resistance of the inductor.
For a series RL circuit:
- Current rise: $I_L(t) = \dfrac{V}{R}\!\left(1-e^{-Rt/L}\right)$
- Current decay: $I_L(t) = I_0\,e^{-Rt/L}$
- Time constant: $\tau = L/R$
where $I_L$ is the current through the inductor, $V$ is the input voltage, and $I_0$ is the initial inductor current before the transient begins. Note the duality: voltage across a capacitor increases with time during charging, while current through an inductor increases with time during the transient; these two quantities have the same mathematical form.
Figure 2: RL circuit experimental setup. The generator internal resistance $R_G \approx 50\,\Omega$. The three resistances $R_G$, $R_L$, and 100 $\Omega$ all contribute to the effective total resistance and therefore to the RL time constant.
1.4 RC and RL Calculations
Before entering the lab, calculate the key parameters for each circuit. Keep the following in mind:
- The time constant $\tau$ defines the rate of the exponential transient.
- After $4\tau$ the circuit has reached approximately 98% of its steady-state value; this interval is the transient response.
- For a square wave input, the period must be long enough relative to $\tau$ to allow full charging and discharging.
Prelab Deliverable #1
Calculate the time constant $\tau$ for an RC circuit with $R = 2.2\,\text{k}\Omega$ and $C = 1\,\mu\text{F}$. Then calculate how long it will take to reach approximately 98% of the steady-state value ($4\tau$). Work on paper, showing all steps. Photograph your completed work and submit the image via the course submission app. Your name must be visible in the photo.
Prelab Deliverable #2
Calculate the time constant $\tau$ for an RL circuit with $R = 100\,\Omega$ and $L = 1\,\text{mH}$. Then calculate how long it will take to reach approximately 98% of the steady-state value ($4\tau$). Work on paper, showing all steps. Photograph your completed work and submit the image via the course submission app. Your name must be visible in the photo.
Prelab Deliverable #3
For the RC circuit with $R = 2.2\,\text{k}\Omega$ and $C = 1\,\mu\text{F}$, determine the maximum square wave frequency that still allows the capacitor to fully charge and discharge during each half-cycle. Justify your answer using the $4\tau$ criterion. Work on paper, showing all steps. Photograph your completed work and submit the image via the course submission app. Your name must be visible in the photo.
1.5 M2K and Scopy Preparation
Prelab Deliverable #4
Describe how you would configure the M2K signal generator in Scopy to produce a square wave with a specified frequency and peak-to-peak amplitude. List the specific Scopy controls you would use.
Prelab Deliverable #5
Describe how you would use the M2K oscilloscope in Scopy to simultaneously capture and display the input voltage and the output voltage (or sense resistor voltage) of the RC and RL circuits. Which channels would you use and how would you connect them?
Practice Problem (Ungraded)
Describe how you would extract the time constant $\tau$ from a captured exponential waveform using the M2K oscilloscope cursors in Scopy. At what voltage level (expressed as a fraction of the final value) does one time constant occur? How would you place the cursors to read this off the display? This will not be collected, but you will need this skill during the lab.
1.6 Circuit Analysis: RC Circuit
Interactive Widget: RC Transient Response
Use the RC Interactive Widget to explore how the capacitor voltage builds and decays as you vary $R$, $C$, and the input frequency. Work through the deliverables below on your own first; then use the widget to check your thinking.
Figure 3: RC circuit for prelab analysis.
For the following deliverables, assume the capacitor is initially uncharged and a 4 V peak-to-peak square wave with period much greater than $5\tau$ is applied.
Prelab Deliverable #6
Calculate the expected voltage across the capacitor after one time constant ($1\tau$) using the charging voltage equation. Report your calculated value and show the key step in your reasoning.
Prelab Deliverable #7(a)
Calculate the expected voltage across the capacitor after five time constants ($5\tau$). Report your calculated value and show the key step in your working.
Prelab Deliverable #7(b)
Explain what the result from Deliverable #7(a) represents physically — what is happening in the circuit after five time constants?
Prelab Deliverable #8
Sketch the expected capacitor voltage waveform $V_o(t)$ for one complete charge-and-discharge cycle. Label the following on your sketch: the initial voltage, the steady-state voltage, the $1\tau$ point on both the rising and falling edges, and the $4\tau$ point. You may use the RC Interactive Widget to check the expected waveform shape. Photograph your completed sketch and submit the image via the course submission app. Your name must be visible in the photo.
1.7 Circuit Analysis: RL Circuit
Interactive Widget: RL Transient Response
Use the RL Interactive Widget to explore how the inductor current rises and decays as you vary $R$ and $L$. Work through the deliverables below on your own first; then use the widget to check your thinking.
Figure 4: RL circuit for prelab analysis. $R_L \approx 100\,\Omega$.
For the following deliverables, assume the inductor carries no initial current and a 4 V peak-to-peak square wave with period much greater than $5\tau$ is applied. Use $R_L = 100\,\Omega$ for your calculations.
Prelab Deliverable #9
Calculate the expected current through the inductor after one time constant ($1\tau$) using the current rise equation. Report your calculated value and show the key step in your reasoning.
Prelab Deliverable #10(a)
Calculate the expected current through the inductor after five time constants ($5\tau$). Report your calculated value and show the key step in your working.
Prelab Deliverable #10(b)
Explain what the result from Deliverable #10(a) represents physically — what is happening in the circuit after five time constants?
Prelab Deliverable #11
Sketch the expected inductor current waveform $I_L(t)$ for one complete rise-and-decay cycle. Label the following on your sketch: the initial current, the steady-state current, the $1\tau$ point on both the rising and falling edges, and the $4\tau$ point. You may use the RL Interactive Widget to check the expected waveform shape. Photograph your completed sketch and submit the image via the course submission app. Your name must be visible in the photo.
2. Lab Procedure
IMPORTANT
Collaboration and Assistance: You are encouraged to collaborate with your fellow students and assist each other during the lab. However, each student is expected to complete their own work and submit their own individual post-lab report. If you encounter any difficulties or have questions, first try to seek assistance from your classmates. If you are unable to resolve the issue with their help, please do not hesitate to ask the student assistant or TA for guidance.
2.1 Part 1: RC Circuit Experiment
Components for RC circuit:
- 2.2 k$\Omega$ resistor
- 1 $\mu$F capacitor
Setup
-
Set up the series RC circuit shown in Figure 5 on your solderless breadboard with component values $R = 2.2~\text{k}\Omega$ and $C = 1~\mu\text{F}$.
-
Measure the resistance of $R$. Measure the capacitance of $C$ (see Measuring Capacitance with a Multimeter). Record your results in Table 1.
| Part | Part value | Measured value | Measurement Error |
|---|---|---|---|
| $C$ | |||
| $R$ |
Table 1: Component Measurements
Lab Deliverable #1
Enter the following measured values directly:
C — Part value, Measured value, Measurement Error
R — Part value, Measured value, Measurement Error
Figure 5: RC circuit experimental setup. The signal generator has an internal resistance of approximately $R_G = 50~\Omega$. Since this internal resistance is approximately 2% of the $2.2~\text{k}\Omega$ series resistance in the circuit, its contribution to the overall time constant is negligible and can be disregarded. Contrast this with the RL experiment, where $R_G$ cannot be ignored. See Section 5.6 of ECE Confidential: Cracking the Code.
-
Connect the M2K to your computer and launch the Scopy software.
-
Configure the connections:
- Connect channel 1 of the oscilloscope (CH1+/CH1-) to visualize the input voltage
- Connect channel 2 of the oscilloscope (CH2+/CH2-) to measure the voltage across the capacitor
- Connect the signal generator (W1/GND) to the input of the circuit
Lab Deliverable #2
Take a clear photo of your breadboard with the RC circuit built. Label the components and connections clearly.
Procedure
-
Generate a square wave on channel 1 of the signal generator with 4 V amplitude peak-to-peak. Look at the measured value of peak-to-peak amplitude, not the setting on the generator. Why? (See Section 5.6 of ECE Confidential: Cracking the Code.)
-
Case 1 (pulse width $\approx 15\tau$): Estimate $\tau$ from the measured component values ($\tau = RC$). Set the frequency such that the capacitor has enough time to fully charge and discharge during each cycle of the square wave; let the pulse width be at least $15\tau_\text{estimated}$ and set the frequency accordingly.
Lab Deliverable #3
Capture screenshots of the oscilloscope display for the pulse width $\approx 15\tau$ case, showing both the input square wave and the output voltage. Capture at least 5 charge and 5 discharge cycles. Ensure that the time base and voltage scales are clearly visible.
Lab Deliverable #4
From your Case 1 screenshot, describe what you observe about the capacitor voltage waveform. Does the capacitor appear to fully charge and discharge within each half-cycle, and how can you tell from the waveform shape?
- Case 2 (pulse width $= \tau$): Do not use the calculated value of $\tau$ to set this frequency. Instead, use the Scopy display directly: the time constant is the time at which the capacitor voltage has reached 63.2% of its final value during charging (this is the $e^{-1}$ point). Adjust the frequency until the pulse width matches this measured $\tau$, then record $\tau$ from the plot.
Lab Deliverable #5
Capture screenshots of the oscilloscope display for the pulse width $\tau$ case, showing both the input square wave and the output voltage. Capture at least 5 charge and 5 discharge cycles. Ensure that the time base and voltage scales are clearly visible.
Lab Deliverable #6
Record the value of $\tau$ measured directly from the Scopy display for the Case 2 waveform (the time at which the capacitor voltage reaches 63.2% of its final value). Then justify why you believe this measurement is correct.
- Case 3 (pulse width $= 5\tau$): Using $\tau_\text{estimated}$ from Case 1, set the frequency so that the pulse width equals $5\tau$. You should observe a waveform such as shown in Figure 6.
Figure 6: Waveform for a pulse width equal to $5\tau$. The blue trace shows the exponential capacitor charge and discharge response to the orange input square wave. The 0.63 V annotation marks the voltage level reached after one time constant $\tau$. Source: Transient Response of an RC Circuit, ADALM2000
Lab Deliverable #7
Capture screenshots of the oscilloscope display for the pulse width $5\tau$ case, showing both the input square wave and the output voltage. Capture at least 5 charge and 5 discharge cycles. Ensure that the time base and voltage scales are clearly visible.
Note
For Case 3 (the $5\tau$ case), export the captured waveform data to CSV. Export time and both channels (CH1 and CH2) for at least 5 charge and 5 discharge cycles. Download and store these files — you will need them for the post-lab computational analysis. No submission is required here.
2.2 Part 2: RL Circuit Experiment
Components for RL circuit:
- 100 $\Omega$ resistor
-
1 mH inductor (use the 1 mH inductor, not the 100 mH)
-
Measure the resistance of the 100 $\Omega$ load resistor $R$ using the Keysight DMM and note the result including the estimated measurement error.
-
Set up the series circuit shown in Figure 7, which places the inductor (with its winding resistance $R_L$) in series with the 100 $\Omega$ resistor.
Figure 7: Circuit for measuring the total series resistance $R_\text{total} = R_L + R$. Connect the DMM across the two open terminals. Use the measured value in all subsequent calculations.
-
Measure the total series resistance $R_\text{total} = R_L + R$ directly across the two open terminals using the DMM. This single measurement is more accurate than measuring $R_L$ and $R$ separately and adding them, because it avoids accumulating two independent measurement errors.
-
Compute the following derived quantities and record all values in Table 2:
- $R_L = R_\text{total} - R$
- $R_\text{circuit} = R_\text{total} + R_G$ (use $R_G = 50~\Omega$)
- $\tau_\text{expected} = L / R_\text{circuit}$ (use $L = 1~\text{mH}$)
You will use $\tau_\text{expected}$ to set the generator frequency in each case below.
| Quantity | Nominal value | Measured / computed value | Measurement error |
|---|---|---|---|
| $R$ | $100~\Omega$ | ||
| $R_\text{total} = R_L + R$ (series, DMM) | N/A | ||
| $R_L$ (derived) | N/A | ||
| $R_\text{circuit} = R_\text{total} + R_G$ | $R_G = 50~\Omega$ | N/A | |
| $\tau_\text{expected} = L / R_\text{circuit}$ | $L = 1~\text{mH}$ | N/A |
Table 2: Component measurements and derived time constant for the RL circuit.
Lab Deliverable #8
Enter the following measured and computed values directly:
R (100 Ω resistor) — Part value, Measured value, Measurement Error
$R_\text{total} = R_L + R$ — Measured value, Measurement Error
$R_L$ (derived) — Computed value
$R_\text{circuit} = R_\text{total} + R_G$ — Computed value
$\tau_\text{expected} = L / R_\text{circuit}$ — Computed valueWhy $R_G$ matters here but not in the RC experiment
In the RC experiment the series resistance was $R = 2.2~\text{k}\Omega$, so $R_G \approx 50~\Omega$ is approximately 2% of the total, small enough to be negligible.
Here the total measured resistance $R_\text{total}$ is roughly 120--130 $\Omega$ (depending on your measured $R_L$), so $R_G \approx 50~\Omega$ is approximately 30% of the total. Ignoring it would produce a time constant that is wrong by the same fraction.
General principle: the same 50 $\Omega$ is negligible in one circuit and significant in the other. Whether an approximation is justified depends on the ratio of the neglected quantity to the total, not on its absolute size. You will quantify this comparison in the post-lab analysis (Section 3).
Setup
- Set up the circuit shown in Figure 8 on your solderless breadboard with $R = 100~\Omega$ and $L = 1~\text{mH}$.
Figure 8: RL circuit experimental setup. The generator has an internal resistance $R_G \approx 50~\Omega$. All three resistances, $R_G$, $R_L$, and the $100~\Omega$ sense resistor, contribute to the RL time constant; see Lab Deliverable #8 for the full calculation.
- Connect the M2K as follows:
- Channel 1 oscilloscope: input node (after $R_G$) to ground; measures the source voltage presented to the RL network
- Channel 2 oscilloscope: across the $100~\Omega$ sense resistor; the voltage here is proportional to inductor current via Ohm's Law
- Signal generator: to the input of the circuit
Lab Deliverable #9
Take a clear photo of your breadboard with the RL circuit built. Label the components and connections clearly.
Procedure
-
Generate a square wave with 4 V amplitude peak-to-peak. (See Section 5.6 of ECE Confidential: Cracking the Code.)
-
Case 1 (pulse width $\approx 15\tau$): Using $\tau_\text{expected}$ from Lab Deliverable #8, set the generator frequency so that the pulse width equals $15\tau_\text{expected}$. The inductor should have enough time to fully charge and discharge within each half-cycle.
Lab Deliverable #10
Capture a screenshot of the oscilloscope display showing both the input square wave (CH1) and the sense resistor voltage (CH2). Include at least 5 charge and 5 discharge cycles. Verify that the time base and voltage scales are clearly visible.
Lab Deliverable #11
From your Case 1 RL screenshot, describe what you observe about the sense resistor voltage waveform. Does the inductor current appear to reach its steady-state value during each half-cycle? Describe the shape of the waveform.
Lab Deliverable #12
From the Case 1 screenshot, measure $\tau$ directly from the Scopy display: identify the 63.2% point on the sense-resistor voltage waveform during a charge cycle and read the corresponding time. Record this measured value of $\tau$. Then justify why you believe this measurement is correct.
- Case 2 (pulse width $= 5\tau$): Using $\tau_\text{expected}$ from Lab Deliverable #8, set the frequency so that the pulse width equals $5\tau_\text{expected}$. You should observe waveforms similar to those shown in Figure 9, with characteristic inductive spikes at each transition.
Figure 9: Expected waveform for pulse width $= 5\tau$: the blue trace shows the inductor current response across the sense resistor, with inductive spikes at each square wave transition. Source: Transient Response of an RL Circuit, ADALM2000
Lab Deliverable #13
Capture a screenshot of the oscilloscope display for the $5\tau$ case, showing both CH1 and CH2 with at least 5 charge and 5 discharge cycles. Time base and voltage scales must be clearly visible.
Lab Deliverable #14
From your Case 2 RL screenshot, describe the sharp voltage spikes you observe on the sense resistor at each square wave transition. What causes these spikes in an RL circuit, and what does their presence tell you about the inductor's behavior?
Self-Verification Checklist
Before leaving the lab, verify that you have collected all the necessary information to complete your post-lab report:
- 1, text entry of measured RC component values (Table 1: C and R — part value, measured value, measurement error)
- 2, photo of RC breadboard with components labeled
- 3, oscilloscope screenshots for RC Case 1 (pulse width $\approx 15\tau$)
- 4, written description of the RC Case 1 waveform (does the capacitor fully charge/discharge?)
- 5, oscilloscope screenshots for RC Case 2 (pulse width $= \tau$)
- 6, $\tau$ value measured from the Case 2 Scopy display (63.2% point) plus justification
- 7, oscilloscope screenshots for RC Case 3 (pulse width $= 5\tau$)
- 8, text entry of measured and computed RL circuit values (Table 2: R, $R_\text{total}$, $R_L$, $R_\text{circuit}$, $\tau_\text{expected}$)
- 9, photo of RL breadboard with components labeled
- 10, oscilloscope screenshots for RL Case 1 (pulse width $\approx 15\tau$)
- 11, written description of the RL Case 1 waveform (does the current reach steady state?)
- 12, measured $\tau$ from RL Case 1 Scopy display (63.2% point) plus justification
- 13, oscilloscope screenshots for RL Case 2 (pulse width $= 5\tau$)
- 14, written description of the inductive spikes observed in the RL Case 2 waveform
3. Post-Lab Analysis Report
For the computational analysis, use the CSV data you saved during the RC experiment. Before you begin, read the AI-Assisted Coding Guide; it explains which tools to use, how to prompt AI coding tools effectively, and what you are required to submit alongside your code. Section 6 of the Guide specifies that every AI-generated code submission must include a code review paragraph — Post-Lab Deliverable #10 collects that paragraph. The RL data is used separately for the time-constant comparison later in this section.
-
Confirm you have the exported CSV data from Case 3 of the RC experiment, with at least 5 charge and 5 discharge cycles in the file.
-
Load the data into your analysis tool of choice: MATLAB, Python, or any environment you are comfortable with. If you prefer, use an AI coding tool (Claude, Copilot, or equivalent) to generate the import and processing code. If you do, paste the generated code into your submission alongside your output.
-
Normalize the waveform amplitudes so that the total swing is 1 V (minimum = 0, maximum = 1). Apply the same scaling to both charge and discharge curves. This removes dependence on the source amplitude and simplifies all subsequent analysis.
-
Identify and extract the individual charge and discharge curves from the normalized data. Each complete charge or discharge curve is one independent measurement of $\tau$. Tip: inverting the charge curves so they resemble discharge curves lets you apply the same extraction method to both.
-
Refer to Appendix A for example extraction code written in MATLAB. If you are using Python or another tool, use an AI coding tool to translate the logic; the mathematical steps are the same regardless of language. See the AI-Assisted Coding Guide for guidance on how to do this effectively.
Post-Lab Deliverable #1
Generate plots of the normalized waveforms showing both the input square wave and the capacitor response for the $5\tau$ case (RC experiment). Clearly label which curve is the input and which is the output. Upload the figure as an image via the course submission app. Your name must be visible in the image before uploading.
Post-Lab Deliverable #2(a)
Direct extraction — statistics: looking at your normalized RC waveforms from Post-Lab Deliverable #1, extract the time constant $\tau$ from every charge and discharge cycle by identifying the time at which the normalized voltage crosses 63.2% of its final value. Report the total number of cycles from which you extracted $\tau$ and the mean $\tau$ and standard deviation across all cycles, in the form mean ± std with units.
Post-Lab Deliverable #2(b)
Direct extraction — statistical interpretation: if you had captured 20 cycles instead of the number you collected, what would you expect to happen to the standard deviation of your per-cycle $\tau$ estimates? Would the mean change? Explain the physical and statistical reason in two to three sentences.
Post-Lab Deliverable #3(a)
Linearization — statistics and code: apply the linearization method to extract $\tau$ from each charge and discharge cycle individually. For each cycle, take the natural log of the normalized exponential response and fit a straight line — the slope gives $-1/\tau$ for that cycle. Refer to Appendix A for the mathematical basis and use an AI coding tool to generate the per-cycle code. Report the total number of cycles analyzed and the mean $\tau$ and standard deviation from the linearization method, in the form mean ± std with units. Paste the AI-generated code into your submission alongside the results.
Post-Lab Deliverable #3(b)
Linearization — representative plot: upload the linearized plot for one representative charge or discharge cycle with the linear fit overlaid. Axes must be labelled. Your name must be visible in the image.
Post-Lab Deliverable #3(c)
Linearization — method comparison: comparing your results from Post-Lab Deliverable #2(a) and Post-Lab Deliverable #3(a), which method gives you more confidence in your estimate of $\tau$, and why?
Post-Lab Deliverable #4
(RC experiment.) Calculate $\tau_\text{calculated} = R_\text{measured} \times C_\text{measured}$ and $\tau_\text{corrected} = (R_\text{measured} + R_G) \times C_\text{measured}$ with $R_G = 50~\Omega$. Report the percentage error of each with respect to the extracted mean $\tau$ from Post-Lab Deliverable #3(a).
Post-Lab Deliverable #5
(RC experiment.) Based on your calculations in Post-Lab Deliverable #4, does including $R_G$ bring the calculated time constant closer to the measured value? Which model is better supported by the data, and why?
Post-Lab Deliverable #6
(RL experiment.) Using the component values from Lab Deliverable #8, calculate $\tau_\text{RL}$ two ways: (1) $\tau = L / R_\text{total,measured}$, ignoring $R_G$; (2) $\tau = L / R_\text{circuit}$, including $R_G = 50~\Omega$. Report both calculated values.
Post-Lab Deliverable #7
(RL experiment.) Using the value of $\tau$ measured from the Scopy display in Lab Deliverable #12, calculate the percentage error between your measured $\tau$ and each of the two values calculated in Post-Lab Deliverable #6. Report both percentage errors.
Post-Lab Deliverable #8
(RL experiment.) Based on your calculations in Post-Lab Deliverable #7, which model — with or without $R_G$ — is better supported by your measured $\tau$? State your conclusion with numerical evidence.
Extension (not graded)
(RL experiment.) Using your measured $\tau$ from Lab Deliverable #12 and $R_\text{circuit}$ from Lab Deliverable #8, back-calculate the inductance $L = \tau \times R_\text{circuit}$. Compare to the nominal 1 mH value and report the percentage error.
This extension exercise is provided for students who want to explore component characterization further. It will not be collected or graded.
Post-Lab Deliverable #9
Write a short structured comparison: for the RC circuit, state with numerical evidence from Post-Lab Deliverable #5 whether ignoring $R_G$ is justified. For the RL circuit, state with numerical evidence from Post-Lab Deliverable #8 whether ignoring $R_G$ is justified. Conclude with a general principle, stated in your own words, that explains when any approximation of this kind is justified; your principle should not be specific to these two circuits.
You are encouraged to use an AI assistant to help structure your analysis or to clarify concepts such as approximation criteria and when to neglect small quantities in circuit analysis. Ask it to explain, check your reasoning, or suggest a framework; then apply that framework to your own data. The analysis you submit must be your own work: use AI as a thinking partner, not as a substitute for your own conclusions.
Post-Lab Deliverable #10
Code review paragraph (see AI-Assisted Coding Guide Section 6). In 3–5 sentences, written in your own words: (a) name the AI tool you used for your computational analysis and describe how you used it — did you iterate on the prompt, and if so, what changed between attempts? (b) identify one specific thing you verified or would change in the generated code, and explain why; (c) state whether the output matched your physical expectations and how you checked.
Submission Instructions
IMPORTANT
Submit your completed work via the course submission app. All plots, images, data tables, and calculations must be clearly labeled and referenced in your post-lab report.
Appendix A: Code Reference Examples
A.1 Calculating Time Constant
The following example is written in MATLAB. If you are using Python or another tool, use an AI coding tool to translate it -- the logic and variable names in the comments will help you describe your data accurately. See the AI-Assisted Coding Guide for prompting guidance.
% Identify rising edge of input square wave
rising_edges = find(diff(input_voltage > mean(input_voltage)) == 1);
% Extract a single charging curve
start_idx = rising_edges(1);
end_idx = rising_edges(2) - 1;
charge_time = time(start_idx:end_idx) - time(start_idx);
charge_voltage = capacitor_voltage(start_idx:end_idx);
% Normalize the charging curve
v_final = max(charge_voltage);
v_initial = min(charge_voltage);
v_normalized = (charge_voltage - v_initial) / (v_final - v_initial);
% Find the time when voltage reaches 63.2% of final value (1-e^-1)
threshold = 0.632;
[~, threshold_idx] = min(abs(v_normalized - threshold));
measured_time_constant = charge_time(threshold_idx);
disp(['Measured time constant: ', num2str(measured_time_constant), ' seconds']);
A.2 Linearizing the Exponential Response
The following example linearizes the normalized charging curve and extracts $\tau$ from the slope of a linear fit. Written in MATLAB; adapt using AI assistance as described in the AI-Assisted Coding Guide.
% Take natural log of the normalized response
% For charging: ln(1-v_normalized)
% For discharging: ln(v_normalized)
% For a charging curve
linearized_data = log(1 - v_normalized);
% Remove data points where linearization is problematic (near 0 or 1)
valid_idx = find(v_normalized > 0.1 & v_normalized < 0.9);
fit_time = charge_time(valid_idx);
fit_data = linearized_data(valid_idx);
% Fit a line to the linearized data
p = polyfit(fit_time, fit_data, 1);
% The slope of the line is -1/tau
calculated_time_constant = -1/p(1);
% Plot the linearized data and fit
figure;
plot(fit_time, fit_data, 'bo', fit_time, polyval(p, fit_time), 'r-');
xlabel('Time (s)');
ylabel('ln(1-v/v_{final})');
title('Linearized Charging Response');
legend('Data', 'Linear Fit');
grid on;
disp(['Calculated time constant from linearization: ', ...
num2str(calculated_time_constant), ' seconds']);
Appendix B: Statistical Analysis of Time Constant Measurements
In this lab you extract $\tau$ from multiple independent cycles (each charge and discharge curve is one measurement). Using several cycles instead of one improves your result for a specific statistical reason: random errors tend to cancel when you average independent measurements, so the mean of many cycles is a more reliable estimate than any single cycle.
B.1 Two Sources of Measurement Error
-
Systematic errors -- consistent offsets that affect every measurement the same way: calibration drift, a wiring resistance you did not account for, a scope probe with nonzero loading. Averaging more cycles does not reduce systematic error. Careful setup and the $R_G$ correction in Post-Lab Deliverable #4 are the tools for systematic error.
-
Random errors -- cycle-to-cycle variation from noise, contact resistance, and trigger timing. These are unpredictable in direction, so they partly cancel when averaged. More cycles reduce their effect on the mean.
B.2 What to Compute and Report
For Post-Lab Deliverables #2 and #3 you are required to report the mean and standard deviation of your per-cycle $\tau$ values.
$$\bar{\tau} = \frac{1}{N}\sum_{i=1}^{N}\tau_i$$
$$s = \sqrt{\frac{\sum_{i=1}^{N}(\tau_i - \bar{\tau})^2}{N-1}}$$
The standard deviation $s$ tells you how spread out your per-cycle estimates are. A small $s$ relative to $\bar{\tau}$ means your measurement is precise (though not necessarily accurate -- that is what the $R_G$ comparison in Post-Lab Deliverable #4 checks).
B.3 Worked Example
Suppose ten cycles yield the following $\tau$ values (in milliseconds):
47.3, 48.1, 46.9, 47.8, 48.2, 47.5, 47.0, 48.3, 47.4, 47.6
- Mean: $\bar{\tau} = 47.61$ ms
- Standard deviation: $s = 0.53$ ms
You would report: "The RC time constant was measured to be $47.61 \pm 0.53$ ms (mean $\pm$ one standard deviation, $N = 10$ cycles)."
IMPORTANT
The precision of your result depends not just on how carefully you take each measurement, but on how many independent measurements you collect. Collecting more cycles costs almost nothing -- the square wave is already running.
IMPORTANT
AI as a thinking partner is the goal. AI as a shortcut that bypasses thinking is not. The same principle applies to AI-generated explanations, analysis, and written answers throughout the course.