Web Simulation 

 

 

 

 

Signal Correlation Explorer 

Correlation is a signal-matching operation. Auto-correlation is what synchronizers use to find the start of a frame; cross-correlation is what receivers use to detect specific known sequences buried in noise. Both produce a single function of lag, with a sharp peak when the template aligns with the corresponding pattern in the received stream.

This tutorial sweeps the lag manually or finds the peak automatically, with controls for noise level and multipath so you can see what 5G PSS / SSS detection actually looks like when the cell signal is weaker than the noise floor.

Mathematical Foundation

For two discrete-time signals x[n] and y[n], the cross-correlation at lag m is:

Rxy[m] = Σn x[n] · y*[n + m]

where y* is the complex conjugate (it drops out for real-valued sequences). When the template x aligns with the matching pattern in y, the sum hits its peak; the lag m at that peak is the time-of-arrival. The simulator plots |R| so the peak is always positive regardless of the underlying sign convention.

Auto-correlation is the special case x = y:

Rxx[m] = Σn x[n] · x*[n + m]

It has a guaranteed peak of N (sequence length) at m = 0. The shape of the sidelobes determines how easily a receiver can lock onto the sequence.

Processing Gain

Because correlation sums coherently over N samples while noise sums incoherently (random walk), the SNR at the correlation peak is improved by:

Gp ≈ 10 · log10(N) dB

For a length-127 PSS, that's ~21 dB of gain — which is why the PSS detection still works at negative input SNR. Crank the Noise slider up and confirm: the time-domain signal becomes invisible while the correlation peak stays clearly above the noise floor.

Sequence Library

Different sequences have different auto-correlation properties, optimized for different applications:

Family

Length

Use

Property

Barker 13 / 11

13 / 11

DSSS, Wi-Fi preamble

Sidelobes ≤ 1; peak = N

Zadoff-Chu

13 / 31

LTE / 5G PRACH

Constant amplitude; ideal cyclic auto-correlation

Gold 31

31

5G NR scrambling

Bounded cross-correlation between members

PN-15

31 chips (segment)

IS-95 CDMA

Pseudo-noise statistics

Walsh-8

8

CDMA orthogonal codes

Zero cross-correlation between rows at lag 0

NR PSS

127

5G cell search

BPSK m-sequence, three cyclic shifts for NID(2)

NR SSS

127

5G physical cell ID

Product of two shifted m-sequences, encodes NID(1)

5G NR encodes the physical cell ID into two short synchronization signals on the SS/PBCH block. Both have length 127 and BPSK chips; both are detected by correlation:

NIDcell = 3 · NID(1) + NID(2)     (0 ≤ NIDcell ≤ 1007)

Signal

What it carries

Spec reference

PSS

NID(2) ∈ {0, 1, 2} via one of 3 cyclic shifts of a single m-sequence

TS 38.211 §7.4.2.2.1

SSS

NID(1) ∈ [0, 335] via the shifts of two m-sequences whose product gives the SSS

TS 38.211 §7.4.2.3.1

The UE first detects which PSS is present (3 candidates), then which SSS (336 candidates given the PSS) — total 1008 cell IDs. The cross-correlation between any two different PSS or SSS sequences is intentionally low, so a detector locked onto one sequence rejects the others.

Multipath

In a real channel the receiver sees the direct path plus delayed reflected copies. Each reflection produces its own correlation peak at the corresponding lag. Toggle the Multipath button to see this directly:

  • Main peak — direct path, highest amplitude, lag = true ToA.
  • Ghost peaks — reflections at later lags, smaller amplitude (and possibly different phase).

A Rake receiver exploits this by detecting and coherently combining several peaks instead of just the strongest. That's how DS-CDMA receivers harvest energy from multipath instead of treating it as interference.

Simulation

The interactive simulator is below. Start with the Barker 13 preset, slide the shift τ until R(τ) peaks (or just click Find Sync), and then crank the noise to see processing gain at work. Try PSS NID2=0 in cross-correlation mode against the wrong reference to see how cell IDs are distinguished.

Controls
0.30 150
0 Sync:
1. Reference Signal
2. Received Signal (Reference + Noise + Delay)
3. Correlation Rxy(τ)

Usage

  1. Mode: Cross-correlation slides the reference over a noisy received signal. Auto-correlation correlates the reference with itself (no noise).
  2. Example: Pick a sequence from the dropdown. Start with Barker 13 for a clean peak, then try Zadoff-Chu or NR PSS for the longer codes.
  3. Noise: Crank it up until the received signal looks like random static. The correlation peak still stands — that's processing gain.
  4. Shift τ: Slide the template manually. The yellow overlay shows where it sits; the Sync indicator turns green at lock.
  5. Find Sync: One-click jump to the maximum |R(τ)| — same operation a real receiver does to lock onto a frame.
  6. Multipath: Toggle to add reflected paths. Watch the correlation plot grow secondary peaks at later lags.
  7. Re-sample Noise: Draws a fresh noise realization at the same noise level.

Visual Guide

Element

Meaning

Blue / cyan trace

Reference sequence (oversampled 10× for short codes, 1 sample/chip for PSS/SSS). Complex sequences split into real / imaginary panels.

Red / cyan trace

Received signal = reference + Gaussian noise + delay.

Yellow overlay

Template position at the current shift τ.

Green trace

Rxy(τ) vs lag. The orange dot marks the current shift.

Sync indicator

Green when the current R(τ) exceeds 80% of the maximum — "lock" detected.

Key Insights

  • Peak position = Time-of-Arrival. The lag at the peak tells the receiver when the frame arrived. GPS, Wi-Fi, and 5G NR all use this for symbol timing.
  • Peak amplitude survives noise. Coherent integration over N samples gives ~10 log10(N) dB of processing gain. For PSS (N = 127) that's ~21 dB — the signal can be 21 dB below noise and still be detected.
  • Multipath shows up as ghost peaks. A Rake receiver detects and coherently combines several peaks instead of just the strongest.
  • NR PSS cross-correlation: in cross-correlation mode, try PSS NID2=0 as reference against received PSS NID2=1. Almost no peak — this is how the UE picks the right one out of three candidates.
  • NR SSS cell-ID separation: SSS PCI=0 and PCI=500 use very different chip patterns. Wrong-reference cross-correlation produces no peak, eliminating neighboring cells during search.

Limitations

  • Simple AWGN noise model — no frequency offset, no phase noise, no quantization.
  • Single-rate detection — no fractional-sample interpolation for sub-chip timing.
  • Multipath is a few discrete echoes, not a continuous tap-delay channel like TDL/CDL.
  • Detection threshold is fixed at 80% of max — real receivers use adaptive thresholds based on noise floor estimation.