A4 Python for engineers · Practice
Reading data and fitting a curve
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
The arrays V and I hold ten noisy measurements of a resistor. Fit a straight line of I against V and set R_fit to the resistance it gives.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
The arrays t (in ms) and v (in volts) hold a noisy capacitor discharge. Fit a line to against and set tau_fit to the time constant in ms.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
A platinum RTD follows above 0 °C, with = 100 Ω. The starter has 15 noisy readings R at temperatures T (°C). Fit a quadratic with np.polyfit and set A_fit and B_fit from its coefficients.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
I (amps) and P (watts) hold noisy measurements of a resistor's power. Fit against with a degree-2 polynomial and set R_fit to its coefficient.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
x and y follow with a little noise. Fit against and set n_fit to the exponent.
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