A4 Python for engineers · Practice
Plots that communicate
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
Check
Plot an RC low-pass's gain in dB, , against f on a log frequency axis, with fc = 1000 Hz. Label the axes with units.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Make a figure with two stacked subplots sharing the frequency axis: gain in dB on top and phase in degrees below, both with log frequency axes, for the RC low-pass with fc = 500 Hz. Label each axis.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
On log-log axes, plot the impedance sizes of a C = 10 nF capacitor and an L = 1 mH inductor from 10 Hz to 10 MHz, with a legend naming them "C" and "L". Set fx to the frequency where they're equal.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
On one figure, plot a voltage V on the left y axis and the current through R = 22 Ω on a second y axis made with ax.twinx(), both against time in ms over 40 ms. Label each y axis with its unit.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
The starter makes 2000 noisy readings of a 5 V reference (noise 2 mV standard deviation). Plot their histogram with plt.hist(x_mV, bins=40), where x_mV is each reading's error from 5 V in millivolts, and label the x axis with its unit and the y axis as a count.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Plot for t from 0 to 10τ (tau = 2 ms) on a log axis with plt.semilogy.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Plot the readings in the starter and draw a dashed horizontal line at the limit lim = 2.5 V with plt.axhline.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in A4