Sub topic 11
Using graphs: slope, intercept and best-fit line
This chapter assumes you know the least count, zero error, and how to propagate errors through products and powers. It also assumes you can rearrange a formula into the form y = mx + c.
Why a graph beats a single calculation
A single pair of readings gives one value of a quantity, and any error in that pair goes straight into the result. A graph uses all the readings together. Random errors in individual points tend to average out, and a systematic error often shows up as a nonzero intercept. You can then read a quantity and its uncertainty from the line instead of from one reading.
The working idea is linearisation. Rearrange the physical law so that one plotted quantity is a straight-line function of another. The slope and intercept then equal known combinations of the unknowns.
| Experiment | Law | Plot (y against x) | Slope | Intercept |
|---|---|---|---|---|
| Ohm's law | V = IR | V against I | R | 0 ideally |
| Simple pendulum | T² = (4π²/g)L | T² against L | 4π²/g | 0 if L is measured to the centre of the bob |
| Stretched wire | e = FL/(AY) | extension e against load F | L/(AY) | 0 ideally |
| Convex lens | 1/v = 1/u + 1/f | 1/v against 1/u | 1 | 1/f |
The graph procedure
Drawing the best-fit line
- The line should have about as many points above it as below it, and the total distance above should roughly equal the total distance below.
- The line need not pass through any data point, and it need not pass through the origin. Force it through the origin only when the physics demands it, and check that the data agree.
- If one point sits far from the trend, check it for a recording or arithmetic mistake. Do not simply delete it.
Calculating the slope
- Choose two points on the line, not two data points. They should lie near opposite ends of the line, because a small separation magnifies the reading error of each point.
- Calculate slope = (y₂ − y₁)/(x₂ − x₁), using the axis units. If the axis is T² in s² and L in m, the slope has units s²/m.
- Do not count squares. Convert grid squares to the physical scale first.
If the axes do not start at zero, the line's y-intercept is not where it meets the left edge of the paper. Extend the line to x = 0 or compute c = y₁ − m·x₁.
Uncertainty from the graph
Draw two extra lines through the scatter. The steepest reasonable line has slope mmax, and the shallowest has mmin. A common estimate is:
Δm ≈ (mmax − mmin)/2
If the quantity you want depends on the slope as g = 4π²/m, apply the usual power rule. The relative error in g equals the relative error in m, because m appears to the power 1.
Least-squares fit by calculation
The least-squares line minimises the sum of squared vertical distances from the points. For n points, with Sxx = Σ(x − x̄)²:
- slope m = Σ(x − x̄)(y − ȳ)/Sxx
- intercept c = ȳ − m·x̄
- standard error of the slope = s/√Sxx, where s² = Σ(residual²)/(n − 2)
import math
I = [0.1, 0.2, 0.3, 0.4] # current in A
V = [0.52, 0.98, 1.53, 2.01] # potential difference in V
n = len(I)
mean_I = sum(I) / n
mean_V = sum(V) / n
sxx = sum((x - mean_I) ** 2 for x in I)
slope = sum((x - mean_I) * (y - mean_V) for x, y in zip(I, V)) / sxx
intercept = mean_V - slope * mean_I
residuals = [y - (intercept + slope * x) for x, y in zip(I, V)]
s = math.sqrt(sum(r ** 2 for r in residuals) / (n - 2))
slope_error = s / math.sqrt(sxx)
intercept_error = s * math.sqrt(1 / n + mean_I ** 2 / sxx)
print(f"R = {slope:.2f} +/- {slope_error:.2f} ohm")
print(f"intercept = {intercept:.3f} +/- {intercept_error:.3f} V")The slope comes out near 5.02 Ω with an uncertainty of about 0.12 Ω. The intercept is about 0.005 V, which is much smaller than its uncertainty of about 0.03 V. This means the data are consistent with a line through the origin, as Ohm's law predicts for an ideal resistor.
Reading the intercept
A nonzero intercept is information, not noise. Common meanings:
- Zero error. If an ammeter reads 0.02 A with no current, the V–I line cuts the I axis at a nonzero value.
- Wrong reference length. In the pendulum, if you measure length l only to the top of the bob, the true length is l + r. Then T² = (4π²/g)(l + r), so the line has a positive T² intercept equal to 4π²r/g, while the slope still gives g correctly.
- End correction. In the resonance tube, plotting length against a suitable variable gives an intercept connected to the end correction.
An intercept that shifts the line sideways leaves the slope unchanged. A slope error needs a different cause, such as a wrong scale or a miscalibrated instrument.
Common traps
- Using data points instead of line points for the slope.
- Using the wrong variables. Plotting T against L gives a curve. Plotting T² against L gives a line.
- Forgetting unit conversion, for example plotting length in cm and then using the slope as if it were per metre.
- Reading a slope as an angle. Use the ratio of the changes in y and x, not tan of a drawn angle, unless both axes have identical scales and units.
- Ignoring a truncated axis when finding the intercept.
Exercise
In a pendulum experiment, a line through the data passes through (0.40 m, 1.60 s²) and (1.60 m, 6.40 s²) on the T² against L graph. Find g.
Show answer
Slope = (6.40 − 1.60)/(1.60 − 0.40) = 4.0 s²/m. Since slope = 4π²/g, g = 4π²/4.0 ≈ 9.87 m/s².
Exercise
A student measures the pendulum length from the suspension point to the top of a bob of radius r, and plots T² against this length l. What does the line look like, and what does the slope give?
Show answer
The true length is l + r, so T² = (4π²/g)l + 4π²r/g. The line has a positive intercept on the T² axis equal to 4π²r/g. The slope is still 4π²/g, so g is unaffected.