Skip to content

Aligning traces before correlation

Pearson r compares y-values at the same x. Different start/stop frequencies, different point counts, or a 10 kHz vs 10 MHz step will produce r values that are not about the DUT.

Two legitimate policies

Policy What it does When
Interpolate Resample every trace onto one common grid spanning the union (or a declared band) Default when all traces cover roughly the same band
Trim Keep only the overlapping x range, then interpolate that overlap to one grid When one file is a narrow zoom and the rest are full-span

If alignment was skipped, say the r values are not meaningful.

Practical checks before r

  • Point count and x-min / x-max from each file (or the trace summary).
  • The same x-unit (Hz vs GHz — a 1e9 scale error looks like “no overlap”).
  • The same y-kind (dB vs linear). Mixing them is not an alignment problem; it is a units problem.

Interpolation details

Linear interpolation on a log-frequency sweep is a compromise: it is wrong in theory and usually fine for QC of similarly sampled VNAs. If two files differ by 10× in point density, resample onto the coarser grid so you do not invent structure. Do not extrapolate past a trace’s own band — pad with NaN and drop those x for everyone, or trim.

Time-domain traces

The same algorithm works on TDR or other waveforms. Align on time, not frequency. Do not mix a time-domain trace and an S21 in one matrix.