---
title: Verifying and reporting
heading: Showing that a capstone meets its requirements, a test for every requirement with a pass criterion, worst-case and statistical tolerance analysis, Monte Carlo yield, how many tests a reliability claim needs, measurement uncertainty and guard bands, and writing the report
eyebrow: D13 · Lesson 14 · Verifying and reporting
xp: 40
---

::: hook
A capstone isn't finished when it works once on the bench. It's finished when you can show, with numbers, that it meets each requirement written in lesson 1, including on the units whose parts sit at the edges of their tolerances, at the temperatures and supply voltages it will see, and with the uncertainty of your own measurements accounted for. That evidence, and an honest account of what didn't work, is what the report is for.
:::

::: play
- A thousand RC low-pass filters built from a 10 kΩ resistor and a 10 nF capacitor, each part drawn uniformly within its tolerance. The histogram is their corner frequencies, nominally 1592 Hz.
- The specification says the corner must be within ±s% of nominal. The measured **yield** is the fraction that pass.
- Tighten the capacitor's tolerance and the spread narrows. Compare the readouts: the worst-case range is much wider than where almost all of the parts actually fall.
:::

```sim plot
view: random
x: f = 1200..2000 Hz
slider: a = 0.1..10 step 0.1 = 1 %
slider: b = 1..20 step 1 = 10 %
slider: s = 1..20 step 1 = 5 %
sample: 1/(2*pi*1e4*(1 + a/100*(2*rand(1) - 1))*1e-8*(1 + b/100*(2*rand(1) - 1))) | mean: M | sd: S
trials: 1000
bins: 40
measure: step(f - 1591.55*(1 - s/100))*step(1591.55*(1 + s/100) - f) | name: Y
readout: yield = Y
readout: worst-case low, Hz = 1591.55/((1 + a/100)*(1 + b/100))
readout: worst-case high, Hz = 1591.55/((1 - a/100)*(1 - b/100))
readout: spread (one standard deviation), Hz = S
```

::: predict
## A filter's corner is set by a 1% resistor and a 10% capacitor. In the worst case, how far above nominal can the corner be?

- [ ] 1%
- [ ] 10%
- [x] 12.2%
- [ ] 20%

::: reveal
The corner is $1/(2\pi RC)$, highest when both parts are at their low limits: 1/(0.99 × 0.90) = 1.122, 12.2% high. Worst-case analysis assumes every part is at its worst at once, which rarely happens; the sim shows how few real filters get near that edge.
:::
:::

::: nameit
## A test for every requirement

For each requirement from lesson 1, write the test, its conditions (temperature, supply voltage, signal levels) and its pass criterion, then record the result. Test the extremes of the conditions, not only the comfortable middle.

## Tolerance analysis

- **Worst case:** put every part at the limit that hurts most. Guaranteed, but pessimistic.
- **Root-sum-square:** independent errors add in quadrature, $\sqrt{e_1^2 + e_2^2 + \cdots}$, for a typical spread.
- **Monte Carlo:** draw every part at random from its distribution, compute the result thousands of times, and count the **yield**, the fraction that meet the specification.

## How many tests

If a unit fails with probability p, the chance that n independent tests all pass is $(1 - p)^n$. To claim p is below a target with confidence C after n passes with no failures, you need

$$n \ge \frac{\ln(1 - C)}{\ln(1 - p)}$$

which at 95% confidence is about 3/p: 300 clean runs to claim a failure rate under 1%.

## Measurement uncertainty

Your instruments have uncertainty too. If a reading must show an error within ±0.5 °C and the reference is good to ±0.1 °C, accept only measured errors within ±0.4 °C: a **guard band**. Independent uncertainties combine like tolerances, by root-sum-square.

## The report

State the requirements, the design and its budgets, the tests and their results with uncertainties, and what failed or was left out, with the reason. A reader should be able to repeat every measurement.
:::

::: example
## What's the RSS spread of the corner for a 1% resistor and a 10% capacitor, and how does it compare with the sim?

::: solution
1. **RSS spread.**
   $$\sqrt{1^2 + 10^2} = 10.05\%$$
   about 160 Hz on 1592 Hz, as a limit.
2. **One standard deviation.** Uniform tolerances have a standard deviation of the limit over √3:
   $$\frac{10.05\%}{\sqrt{3}} = 5.8\%$$
   or 92 Hz.
3. **Compare with the sim.** That matches the spread readout, and it's well inside the worst-case window.

**Answer:** 10.05% (about 160 Hz) as a limit, or 5.8% (92 Hz) as one standard deviation, matching the sim's spread readout.
:::
:::

::: example
## A sensor node must not lose a packet more than once in 1000. How many packets must pass in a row to claim that at 90% confidence?

::: solution
1. **Solve for n.**
   $$\begin{aligned} n &\ge \frac{\ln 0.1}{\ln 0.999} \\ &= 2301.4 \end{aligned}$$
2. **Round up.** That's 2302 clean packets.
3. **At 99% confidence.** It would take 4603.

**Answer:** 2302 clean packets in a row, or 4603 for 99% confidence.
:::
:::

::: check
given: a = 0.5 | 1 | 5; b = 5 | 10 | 20
answer: 100*(1/((1 - a/100)*(1 - b/100)) - 1)
tolerance: 0.5%

## An RC corner uses a resistor of ±{a}% and a capacitor of ±{b}%. In the worst case, how many percent above nominal can it be?

::: right
Right. $1/((1 - a)(1 - b))$ is {answer}% high.
:::

::: misses
- [a + b] That's close for small tolerances, but the corner divides by RC, so the high side is larger.
- [sqrt(a^2 + b^2)] That's the RSS estimate of a typical spread.
- [any] Not yet. Both parts at their low limits.
:::
:::

::: check
given: a = 1 | 2 | 5; b = 3 | 5 | 10 | 20
answer: sqrt(a^2 + b^2)
tolerance: 0.5%

## Two independent errors of {a}% and {b}% combine. What's their root-sum-square?

::: right
Right. $\sqrt{a^2 + b^2}$ = {answer}%.
:::

::: misses
- [a + b] That's the worst case; independent errors rarely line up.
- [any] Not yet. Add in quadrature.
:::
:::

::: check
given: p = 0.05 | 0.01 | 0.001; C = 0.9 | 0.95 | 0.99
answer: ceil(log(1 - C)/log(1 - p))
tolerance: 0.4

## With no failures allowed, how many tests must pass to claim a failure rate below {p} with confidence {C}?

::: right
Right. The smallest n with $(1 - p)^n \le 1 - C$ is {answer}.
:::

::: misses
- [any] Not yet. Solve $(1 - p)^n = 1 - C$ for n and round up.
:::
:::

::: check
given: R = 0.3 | 0.5 | 1; u = 0.05 | 0.1 | 0.2
answer: R - u
unit: °C
tolerance: 0.5%

## A thermometer must read within ±{R} °C, and the reference you test it against is good to ±{u} °C. What's the largest measured error you should accept?

::: right
Right. A guard band of the reference's uncertainty: ±{answer} °C.
:::

::: misses
- [R + u] The guard band is subtracted: a measured error near the limit might hide a real one beyond it.
- [any] Not yet. Shrink the limit by the reference's uncertainty.
:::
:::

::: check
given: n = 30 | 100 | 300 | 3000
answer: 3/n*100
tolerance: 1%

## A capstone's {n} test runs pass with no failures. At 95% confidence, below what failure probability, in percent, does that put the design (the rule of three)?

::: right
Right. $3/n$ = {answer}%: passing tests bound the failure rate; they don't prove it's zero.
:::

::: misses
- [1/n*100] The 95% bound is about $3/n$, not $1/n$.
- [0] Zero failures in a finite test can't prove a zero failure rate.
- [any] Not yet. $p_{95} \approx 3/n$.
:::
:::

::: check
given: s = 1 | 1.5 | 2
answer: (1 - erfc(s/sqrt(2)))*100
tolerance: 0.5%

## A parameter is Gaussian, and the specification limits sit ±{s} standard deviations from its mean. What percentage of units pass?

::: right
Right: {answer}%.
:::

::: misses
- [(1 - erfc(s/sqrt(2))/2)*100] That's one-sided. Both limits reject units.
- [any] Not yet. The fraction within ±{s}σ of a Gaussian: $1 - \text{erfc}(s/\sqrt2)$.
:::
:::

::: explain
## Why do engineers use Monte Carlo or RSS analysis when worst-case analysis already guarantees the result?

::: model
Worst-case analysis assumes every part sits at its most harmful limit at the same time. With several independent parts that's extremely unlikely, so designing for it forces tighter, more expensive parts or wider margins than real production needs. RSS and Monte Carlo analysis use the fact that independent errors usually partly cancel, predicting the spread most units will actually have and the yield, the fraction that will pass. Engineers then choose: worst case where a single failure is unacceptable, such as safety limits, and statistical analysis where a small, known fraction of rejects is cheaper than tightening every part.
:::
:::

::: practice

::: check
given: a = 0.1 | 2; b = 1 | 30
answer: 100*(1/((1 - a/100)*(1 - b/100)) - 1)
tolerance: 0.5%

## Worst-case high corner: ±{a}% and ±{b}%?

::: misses
- [any] $1/((1 - a)(1 - b)) - 1$.
:::
:::

::: check
given: p = 0.1 | 0.0001; C = 0.5 | 0.999
answer: ceil(log(1 - C)/log(1 - p))
tolerance: 0.4

## Zero-failure tests for p < {p} at confidence {C}?

::: misses
- [any] $\lceil\ln(1 - C)/\ln(1 - p)\rceil$.
:::
:::
:::
