Sharp edges
Compare Haar and cosine reconstructions of steps and a spike, keeping eight coefficients in each.
Signals / compression / noise
Compare Haar, cosine, and sample representations under one coefficient budget. Explore compression and controlled noise.
Each starter opens a reference experiment and adds two named runs to your notebook. Existing saved runs are kept.
Compare Haar and cosine reconstructions of steps and a spike, keeping eight coefficients in each.
Keep one component in each representation. The generated reference is rounded to whole numbers.
Compare six and 32 Haar coefficients from the same noisy observations. Inspect their errors against the known reference.
Compare two Haar ranking rules on a 16-sample benchmark, retaining one coefficient under each rule.
Drag across the plot to draw whole-number reference samples from −64 to 64. Crossed addresses are filled between pointer positions. Finish drawing to see the noisy reconstruction. Escape cancels a stroke and leaves drawing mode.
The diagram appears when JavaScript is available. The worked calculation is linked below.
Save competing setups, rename their rows, and restore them later. Runs are saved in this browser. Download notebook JSON to keep or exchange the collection; importing appends runs and recomputes their results. Reset lab keeps the notebook.
Save the current run, change its budget or representation, then save another run to compare.
| Run name | Setup | Retained | Error to reference · Σ(x̂ − x)² | Discarded energy · Σ(y − x̂)² | Actions |
|---|
| Address | Reference | Observed | Run A | Run B | A − reference | B − reference | B − A |
|---|
| Representation | Error to reference · Σ(x̂ − x)² | Discarded energy · Σ(y − x̂)² |
|---|---|---|
Select a representation to inspect its reconstruction and coefficients. The original noise energy is .
Reference error for every coefficient budget. Click the graph or move the budget slider.
The diagram appears when JavaScript is available. The worked calculation is linked below.
Weighted coefficient energy. Solid bars are kept; outlined bars are omitted. Tap a bar to inspect it.
The diagram appears when JavaScript is available. The worked calculation is linked below.
The diagram appears when JavaScript is available. The worked calculation is linked below.
Use 16, 32, 64, 128, or 256 whole-number reference samples from −64 to 64. Paste values, or import a numeric CSV with a reference, value, or sample column. A saved experiment JSON restores the complete setup.
Imported samples become the known reference. The noise control adds simulated noise afterward; this experiment does not estimate an unknown real-world clean signal.
| Address | Reference | Observed | Reconstructed | Discarded residual |
|---|
The reference x is known. Observations y = x + noise use a fixed seeded integer sequence. The reconstruction x̂ uses the selected coefficients of y. The two errors compare x̂ with x and with y respectively; they answer different questions.
Haar analysis uses pair averages and half-differences. Its global mean has weight N and a level-j detail has weight 2ʲ. Cosine analysis uses the orthonormal DCT-II, with a separately normalized constant mode. Sample coordinates use the identity basis. Each representation has exactly N coefficients.
For an orthogonal basis, omitting a coefficient loses its weighted squared magnitude. Keeping the largest weighted energies therefore minimizes squared error to the observed samples at a fixed budget, in exact arithmetic. Largest raw magnitude is a different rule for the averaging-normalized Haar coefficients. Prefix order means coarse-to-fine Haar details, low-to-high cosine modes, or the earliest sample addresses.
The minimum button uses the known reference curve, choosing its smallest budget within 10⁻¹⁰ times max(1, reference energy) of the minimum. It is an experimental reference comparison, not a rule for choosing a budget when the clean signal is unknown. Cosine calculations use floating-point arithmetic; plotted and displayed values are numerical approximations.
Guided interactive diagrams · DCT normalization convention · Worked Haar calculation · Wavelet and polyphase walkthrough