Signals / compression / noise

Signal laboratory

Compare Haar, cosine, and sample representations under one coefficient budget. Explore compression and controlled noise.

Start with a comparison experiment

Each starter opens a reference experiment and adds two named runs to your notebook. Existing saved runs are kept.

Sharp edges

Compare Haar and cosine reconstructions of steps and a spike, keeping eight coefficients in each.

A cosine-like tone

Keep one component in each representation. The generated reference is rounded to whole numbers.

Does more detail help?

Compare six and 32 Haar coefficients from the same noisy observations. Inspect their errors against the known reference.

Magnitude or energy?

Compare two Haar ranking rules on a 16-sample benchmark, retaining one coefficient under each rule.

Experiment controls64 samples · 12 kept · noise ±4
Build the experiment

Seed 17 · bounded integer noise.

Waveform parameters and seed

Preset samples are rounded to whole numbers. Imported data supplies its own sample count.

Signal reconstruction · Haar wavelets

Clean referenceObserved with noiseSelected reconstruction
Inspect a sample

Edit the selected sample precisely
Set a reference sample

Experiment notebook 0 / 12 saved runs

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.

Same budget. Three representations.

12 of 64 coefficients retained in each representation
RepresentationError to reference · Σ(x̂ − x)²Discarded energy · Σ(y − x̂)²
——
——
——

Select a representation to inspect its reconstruction and coefficients. The original noise energy is —.

When does adding detail help?

Reference error for every coefficient budget. Click the graph or move the budget slider.

Haar waveletsCosine modesSample coordinates

Find a budget for a quality target
Find the smallest qualifying coefficient budgets

Smallest qualifying budget in each representation
BasisKeptEnergy retainedApply

RMS means √(squared error / sample count). Reference-error targets use the known clean signal and are experimental comparisons. Every coefficient budget is checked; a target may be unreachable. Numerical comparisons allow 10⁻¹⁰ × max(1, the relevant signal energy) in squared-error units. A zero-energy observation meets energy-retention targets with zero coefficients.

Which components survive?

Weighted coefficient energy. Solid bars are kept; outlined bars are omitted. Tap a bar to inspect it.

Inspect a coefficient

Selected contribution, if retained

Import your own signal

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.

Import signal data
Inspect every sample
Selected reconstruction at every address
AddressReferenceObservedReconstructedDiscarded residual
Conventions and how to interpret the comparison

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