A455 of 56
0 XP
  1. Hook
  2. Problems

A4 · Problem set 12

Problem set 12: longer labs

Longer labs that combine the whole course: functions and data structures, arrays, complex numbers, root finding, simulation, statistics and the FFT. Each uses your own values. Plan each one on paper before you write code.

Check

Find the RC low-pass filter's −3 dB frequency numerically: write the magnitude in dB as a function of f, and use bisection between 1 Hz and 10 MHz to find where it equals −3.0103 dB. Set f3. (Check it against 1/2πRC.)

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

An inductor current builds up as di/dt=(Vs−Ri)/L. Simulate it with Euler's method from 0 A, with a step of L/(100R) for 500 steps, store the currents in i (501 values), and set err to the largest difference from the exact VsR(1−e−tR/L).

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

A capacitor discharges through an unknown resistor. The arrays t (s) and v (V) are noisy readings, and C is known. Fit the time constant from ln⁡v against t, then set R_fit to the resistance.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

For a series RLC with R = 1000 Ω, C = 10 nF and L = 47 mH, compute the voltage across the capacitor for a 1 V input as a complex transfer function over 400 log-spaced frequencies from 100 Hz to 1 MHz. Set f_peak to the frequency of the largest gain on that grid, gain_peak to the gain there, and Q to the theoretical 1RL/C.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

A mains current is a fundamental at f1 = 50 Hz (amplitude 1 A) plus a harmonic h = 3 times higher with amplitude a = 0.2 A, sampled at 12 kHz for exactly 10 cycles of the fundamental. From the FFT, set I1 and Ih to the two amplitudes, thd to the total harmonic distortion Ih/I1, and irms to the RMS current computed from the samples.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Have paper and a calculator ready. Work each problem out by hand, then enter the answer. Your first try on each one counts toward your score.

Practice

Keep practicing

7 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.