Channelization: Structured Channel Sharing
Code Orthogonality: The Mathematical Foundation of CDMA
Read aloud is unavailable in this browser.
The Mathematics of Separation: How Codes Create Isolation
CDMA's ability to separate simultaneous transmissions on the same frequency rests on a profound mathematical concept: orthogonality. When we say two codes are orthogonal, we mean that when we multiply them together and sum the result, we get zero. This "zero cross-correlation" property is what allows a receiver to completely ignore all signals except the one intended for it.
Orthogonality is familiar from geometry—perpendicular vectors have zero dot product. But in CDMA, we extend this concept to sequences of numbers (codes), and the consequences are far-reaching. Understanding orthogonality deeply reveals why CDMA works, when it fails, and what design choices system architects must make.
This page explores orthogonality from first principles through advanced implications, giving you the mathematical intuition to understand CDMA's power and limitations.
By the end of this page, you will understand orthogonality mathematically and intuitively, master cross-correlation computation, comprehend why synchronization is critical for Walsh code orthogonality, learn about quasi-orthogonal codes for asynchronous systems, and appreciate the design trade-offs between code families.
Mathematical Definition of Orthogonality
Let's begin with the rigorous mathematical definition, then build intuition from there.
Discrete-Time Definition:
Two code sequences $c_1$ and $c_2$, each of length $N$, are orthogonal if:
$$\sum_{i=0}^{N-1} c_1[i] \cdot c_2[i] = 0$$
This sum is the inner product (or dot product) of the sequences. For CDMA codes using ${-1, +1}$ values, orthogonality means the codes have equal numbers of agreements and disagreements.
Continuous-Time Definition:
For continuous-time signals over period $T$:
$$\int_0^T c_1(t) \cdot c_2(t) , dt = 0$$
Normalized Cross-Correlation:
The cross-correlation $\rho_{12}$ is often normalized to the range $[-1, +1]$:
$$\rho_{12} = \frac{1}{N} \sum_{i=0}^{N-1} c_1[i] \cdot c_2[i]$$
For orthogonal codes: $\rho_{12} = 0$
For identical codes: $\rho_{11} = 1$ (autocorrelation at zero lag)
Testing Orthogonality of Walsh Codes
Verify that Walsh codes W1 and W2 from a length-4 set are orthogonal.
**Walsh codes (length 4):**
- W1 = [+1, -1, +1, -1]
- W2 = [+1, +1, -1, -1]**Computing inner product:**
$$\sum_{i=0}^{3} W1[i] \cdot W2[i]$$
$= (+1)(+1) + (-1)(+1) + (+1)(-1) + (-1)(-1)$
$= +1 - 1 - 1 + 1$
$= 0$ ✓
**Verification:** W1 and W2 agree on positions 0 and 3, disagree on positions 1 and 2.
Agreements: 2, Disagreements: 2
Since agreements = disagreements, inner product = 0.
**The codes are orthogonal.**For binary codes with values {-1, +1}, orthogonality requires exactly half the positions to match and half to differ. This is why orthogonal code sets always have lengths that are powers of 2 (for Walsh codes) or carefully designed lengths (for other families).
Cross-Correlation and Auto-Correlation
Understanding correlation functions is essential for analyzing CDMA code performance. Two types of correlation matter: cross-correlation (between different codes) and auto-correlation (a code with itself at different time shifts).
Cross-Correlation Function:
The cross-correlation of codes $c_1$ and $c_2$ as a function of time shift $\tau$ is:
$$R_{12}(\tau) = \sum_{i=0}^{N-1} c_1[i] \cdot c_2[(i + \tau) \mod N]$$
For CDMA, we want $R_{12}(0) = 0$ (orthogonality at zero lag), but what about other shifts?
Perfect vs. Practical Orthogonality:
- Walsh codes have $R_{12}(0) = 0$ but $R_{12}(\tau) eq 0$ for $\tau eq 0$
- PN sequences have $R_{12}(\tau) \approx 0$ for all $\tau$, but never exactly zero
- Gold codes have bounded $|R_{12}(\tau)| \leq t(n)$ where $t(n)$ depends on sequence length
Auto-Correlation Function:
The auto-correlation of a code with a time-shifted version of itself:
$$R_{11}(\tau) = \sum_{i=0}^{N-1} c_1[i] \cdot c_1[(i + \tau) \mod N]$$
Ideal auto-correlation has a sharp peak at $\tau = 0$ and zero elsewhere:
$$R_{11}(\tau) = \begin{cases} N & \tau = 0 \ 0 & \tau eq 0 \end{cases}$$
This is crucial for synchronization—the receiver correlates with the code, and the peak tells it exactly when the code starts.
| Code Family | Cross-Corr (aligned) | Cross-Corr (shifted) | Auto-Corr (peak) | Auto-Corr (off-peak) |
|---|---|---|---|---|
| Walsh (length N) | 0 (perfect) | ≤ N (poor) | N | Varies, ≤ N |
| PN (m-sequence) | −1/N (near zero) | −1/N (near zero) | N | −1 |
| Gold (length N) | ≤ t(n)/N | ≤ t(n)/N | N | ≤ t(n) |
| Kasami (large set) | ≤ 2^(n/2)/N | ≤ 2^(n/2)/N | N | ≤ 2^(n/2) |
No code family is perfect at everything. Walsh codes have perfect zero-lag cross-correlation but poor shifted cross-correlation. PN sequences have good auto-correlation everywhere but non-zero cross-correlation. This trade-off drives the use of different codes for different purposes in real CDMA systems.
Walsh-Hadamard Codes: Perfect Synchronous Orthogonality
Walsh codes (also called Hadamard codes) provide perfect orthogonality when users are synchronized. They form the backbone of channel separation in CDMA systems.
Hadamard Matrix Construction:
Walsh codes are the rows of a Hadamard matrix, constructed recursively:
$$H_1 = [1]$$
$$H_2 = \begin{bmatrix} 1 & 1 \ 1 & -1 \end{bmatrix}$$
$$H_4 = \begin{bmatrix} 1 & 1 & 1 & 1 \ 1 & -1 & 1 & -1 \ 1 & 1 & -1 & -1 \ 1 & -1 & -1 & 1 \end{bmatrix}$$
$$H_{2N} = \begin{bmatrix} H_N & H_N \ H_N & -H_N \end{bmatrix}$$
Key Properties:
- $H_N$ is an $N \times N$ matrix with elements ${-1, +1}$
- $H_N \cdot H_N^T = N \cdot I_N$ (each row is orthogonal to every other row)
- All rows are mutually orthogonal
- Only $N$ orthogonal codes of length $N$ exist
| Code | Sequence | Binary Pattern | Use in IS-95 |
|---|---|---|---|
| W0 | +1+1+1+1+1+1+1+1 | 00000000 | Pilot (always transmitting) |
| W1 | +1-1+1-1+1-1+1-1 | 01010101 | Traffic channel |
| W2 | +1+1-1-1+1+1-1-1 | 00110011 | Traffic channel |
| W3 | +1-1-1+1+1-1-1+1 | 01100110 | Traffic channel |
| W4 | +1+1+1+1-1-1-1-1 | 00001111 | Traffic channel |
| W5 | +1-1+1-1-1+1-1+1 | 01011010 | Traffic channel |
| W6 | +1+1-1-1-1-1+1+1 | 00111100 | Traffic channel |
| W7 | +1-1-1+1-1+1+1-1 | 01101001 | Traffic channel |
Verifying All Walsh-8 Codes Are Mutually Orthogonal
Show that any pair of codes from the Walsh-8 set is orthogonal.
**Test pair:** W3 and W5
- W3 = [+1, -1, -1, +1, +1, -1, -1, +1]
- W5 = [+1, -1, +1, -1, -1, +1, -1, +1]**Element-wise product:**
$W3 \cdot W5 = [(+1)(+1), (-1)(-1), (-1)(+1), (+1)(-1), (+1)(-1), (-1)(+1), (-1)(-1), (+1)(+1)]$
$= [+1, +1, -1, -1, -1, -1, +1, +1]$
**Sum:** $+1+1-1-1-1-1+1+1 = 0$ ✓
**For any pair Wi, Wj (i ≠ j):**
The Hadamard construction ensures that exactly half the positions have the same sign and half have opposite signs.
**Number of orthogonal pairs in Walsh-8:** $\binom{8}{2} = 28$ pairs, all with inner product = 0.Walsh orthogonality requires perfect time alignment. If codes are shifted by even one chip, orthogonality is destroyed. This is why Walsh codes are used on the synchronous downlink (base station to mobile) but not the asynchronous uplink (mobiles to base station cannot all synchronize precisely to chip boundaries).
The Impact of Timing Errors on Orthogonality
Walsh codes' perfect orthogonality holds only at zero time shift. In practice, signals arrive at different times due to propagation delays, multipath, and timing imperfections. Understanding how timing errors destroy orthogonality is crucial for CDMA system design.
Shifted Cross-Correlation:
Consider Walsh codes W1 and W2 (length 4):
- W1 = [+1, -1, +1, -1]
- W2 = [+1, +1, -1, -1]
At zero shift: $R_{12}(0) = (+1)(+1) + (-1)(+1) + (+1)(-1) + (-1)(-1) = 0$ ✓
At shift $\tau = 1$ (W2 shifted by one position):
- W2 shifted = [-1, +1, +1, -1] (cyclic shift)
- $R_{12}(1) = (+1)(-1) + (-1)(+1) + (+1)(+1) + (-1)(-1) = -1 - 1 + 1 + 1 = 0$
Actually, W1 and W2 happen to remain orthogonal at shift 1. Let's try W1 and W3:
- W1 = [+1, -1, +1, -1]
- W3 = [+1, -1, -1, +1]
At shift $\tau = 1$ (W3 shifted):
- W3 shifted = [+1, +1, -1, -1]
- $R_{13}(1) = (+1)(+1) + (-1)(+1) + (+1)(-1) + (-1)(-1) = 1 - 1 - 1 + 1 = 0$
Let me try W1 and W4:
- W1 = [+1, -1, +1, -1]
- W4 = [+1, +1, +1, +1]
At shift $\tau = 0$: $R_{14}(0) = 1 - 1 + 1 - 1 = 0$ ✓ At shift $\tau = 1$: W4 shifted = [+1, +1, +1, +1] (unchanged, all same) $R_{14}(1) = 1 - 1 + 1 - 1 = 0$ ✓ (W4 is constant)
Let's examine a more compelling example with length-8 codes:
W2 and W3 (length 8):
- W2 = [+1, +1, -1, -1, +1, +1, -1, -1]
- W3 = [+1, -1, -1, +1, +1, -1, -1, +1]
At $\tau = 0$: Inner product = 0 ✓
At $\tau = 1$ (W3 cyclic shifted right by 1):
- W3' = [+1, +1, -1, -1, +1, +1, -1, -1]
$R_{23}(1) = (+1)(+1) + (+1)(+1) + (-1)(-1) + (-1)(-1) + (+1)(+1) + (+1)(+1) + (-1)(-1) + (-1)(-1)$ $= 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 8$ ✗
Complete correlation! A one-chip shift made W3 identical to W2!
As shown above, a single chip timing error can transform zero cross-correlation into maximum cross-correlation. In practice, partial chip errors create proportional interference. This is why CDMA systems use precise timing advance on downlink and avoid Walsh codes on asynchronous uplink.
Multipath Impact:
Multipath propagation causes copies of the signal to arrive at different times. Consider a two-ray channel where:
- Direct path: arrives at time $t_0$
- Reflected path: arrives at time $t_0 + \tau$ with attenuation $\alpha$
Received signal: $r(t) = s(t) + \alpha \cdot s(t - \tau)$
When the receiver despreads:
- Direct path: fully correlated (orthogonality maintained)
- Reflected path: shifted, potentially non-orthogonal
The reflected path creates self-interference from other Walsh channels. In severe multipath (like indoor environments with delay spreads > 1 chip), significant orthogonality loss occurs.
PN Sequences: Managing Asynchronous Interference
Since Walsh codes lose orthogonality when shifted, CDMA systems need codes with better shifted correlation properties for asynchronous operation. Pseudo-Noise (PN) sequences fill this role.
Maximum-Length Sequences (m-sequences):
PN sequences generated by Linear Feedback Shift Registers (LFSRs) exhibit remarkable properties:
- Period: $N = 2^n - 1$ for an $n$-stage LFSR
- Balance: Contains $2^{n-1}$ ones and $2^{n-1} - 1$ zeros (nearly balanced)
- Run property: Runs of consecutive same values follow specific pattern
- Autocorrelation: Sharp peak at zero, approximately $-1/N$ elsewhere
Autocorrelation of m-sequence:
$$R(\tau) = \begin{cases} N & \tau = 0 \ -1 & \tau eq 0 \end{cases}$$
This two-valued autocorrelation is ideal for synchronization—a sharp peak indicates alignment.
Gold Code Construction:
While m-sequences have excellent autocorrelation, their cross-correlation can take on many values, some quite large. Gold codes combine pairs of m-sequences to create larger sets with bounded cross-correlation.
Construction: For two m-sequences $a$ and $b$ of period $N = 2^n - 1$:
$$G^{(k)} = a \oplus T^k b \quad \text{for } k = 0, 1, ..., N-1$$
where $T^k b$ is sequence $b$ shifted by $k$ positions and $\oplus$ is XOR.
Gold code set size: $N + 2$ codes (the two original m-sequences plus $N$ XOR combinations)
Cross-correlation bound: For properly chosen preferred pairs: $$|R_{ij}(\tau)| \leq t(n) = \begin{cases} 2^{(n+1)/2} + 1 & n \text{ odd} \ 2^{(n+2)/2} + 1 & n \text{ even} \end{cases}$$
| Property | Walsh Codes | PN (m-sequences) | Gold Codes |
|---|---|---|---|
| Set size (length N) | N codes | Few (limited pairs) | N + 2 codes |
| Cross-corr at τ=0 | 0 (perfect) | Variable | Variable |
| Cross-corr shifted | Up to N (poor) | ≈ 0 (good) | Bounded (good) |
| Autocorrelation | Variable | Two-valued (ideal) | Three-valued |
| Synchronization needed | Chip-level | Bit-level | Bit-level |
| Primary use | Synchronous downlink | Scrambling, uplink | Large code sets |
IS-95 uses Walsh codes on downlink (all channels synchronized by base station) and long PN codes on uplink (mobiles transmit asynchronously). The combination leverages Walsh's perfect synchronous orthogonality while using PN codes where synchronization cannot be guaranteed.
OVSF: Orthogonal Variable Spreading Factor Codes
Modern CDMA systems need to support multiple data rates—voice at 12 kbps, video at 384 kbps, data at 2 Mbps—while maintaining orthogonality. Orthogonal Variable Spreading Factor (OVSF) codes solve this problem elegantly.
The Challenge:
Different data rates require different spreading factors:
- Low rate (voice): High SF (e.g., 256) → long codes
- High rate (data): Low SF (e.g., 4) → short codes
Short and long Walsh codes are not automatically orthogonal—a length-4 code might correlate with part of a length-64 code.
OVSF Tree Structure:
OVSF codes are organized as a tree where:
- Root: SF = 1, single code
- Each node spawns two children with doubled SF
- Codes from a parent-child line are not orthogonal
- Codes from different branches are orthogonal
OVSF Allocation Rules:
- Ancestor blocking: When a code is allocated, all its ancestors and descendants become unavailable
- Sibling orthogonality: Codes on different branches (not ancestor-descendant) remain orthogonal regardless of SF
- Capacity trade-off: One SF=4 user blocks four potential SF=16 users
Code Allocation Example:
If we allocate C4_1 = (1,1,1,1), then:
- ✗ C2_1 = (1,1) is blocked (parent)
- ✗ C1 = (1) is blocked (grandparent)
- ✗ All descendants of C4_1 are blocked (if tree extended)
- ✓ C4_2, C4_3, C4_4 are available (siblings, cousins)
- ✓ C2_2 is available (uncle)
OVSF Code Allocation for Mixed Traffic
Allocate codes for one 2 Mbps data user and multiple voice users.
**WCDMA scenario:**
- SF = 4 for 2 Mbps data
- SF = 128 for 12.2 kbps voice
- Need: 1 data user + maximum voice users**Step 1:** Allocate SF=4 code for data user
Choose C(4,1): blocks 1/4 of the code tree
**Step 2:** Calculate blocked voice codes
SF=128 codes under C(4,1): 128/4 = 32 codes blocked
**Step 3:** Available voice codes
Total SF=128 codes: 128
Blocked: 32
Available: 128 - 32 = 96 voice users
**Trade-off:** 1 high-rate user consumes capacity equivalent to 32 voice users
**Optimal allocation:** Place data user on code path with fewest active voice users to minimize disruption.WCDMA (3G) uses OVSF codes to simultaneously support diverse services. The network must carefully manage code allocation to maximize capacity—placing high-rate users to minimize blocking, and potentially reassigning voice users when data sessions start. This code management is a critical 3G network function.
Practical Implications of Orthogonality
The mathematical properties of code orthogonality have profound practical implications for CDMA system design, capacity, and performance.
- •Downlink vs. Uplink Asymmetry — Downlink (base to mobile) is synchronous—base controls all timing. Walsh codes work perfectly. Uplink (mobile to base) is asynchronous—mobiles are at different distances, cannot synchronize to chip level. PN codes required, causing interference.
- •Orthogonality Factor — In real deployments, multipath degrades downlink orthogonality. The orthogonality factor $\alpha$ (0 < α < 1) measures remaining orthogonality. Urban environments: α ≈ 0.4–0.6. Rural: α ≈ 0.9. Lower α means more intra-cell interference.
- •Cell Breathing — Since orthogonality isn't perfect in practice, interference-limited capacity depends on load. As load increases, cell range shrinks ("breathing in"). Network planning must account for coverage at maximum load, not just minimum load.
- •Power Control Precision — Non-orthogonality means each user creates some interference to others. Power control must be precise—excess power from one user degrades all others. The 800 Hz IS-95 power control rate directly addresses this.
- •Soft Handoff Benefits — During soft handoff, the mobile receives the same signal from multiple base stations. Since downlinks from different cells use different PN offsets (not orthogonal), combining them provides diversity gain rather than interference—exploiting the inevitable inter-cell interference.
| Environment | Delay Spread | Orthogonality Factor (α) | Capacity Impact |
|---|---|---|---|
| Indoor | 10–100 ns | 0.9–1.0 | Near-ideal, Walsh works well |
| Suburban | 100 ns–1 µs | 0.5–0.8 | Moderate degradation |
| Urban | 1–3 µs | 0.4–0.6 | Significant interference |
| Mountainous | 3–10 µs | 0.2–0.4 | Severe multipath |
| Satellite | < 10 ns | 0.95–1.0 | Excellent (single path) |
Downlink capacity is approximately proportional to orthogonality factor. In an urban environment with α = 0.5, capacity is roughly half of what perfect orthogonality would provide. This is why CDMA capacity projections often differ significantly from actual deployments—theoretical analyses assume perfect orthogonality that reality doesn't provide.
KEEP LEARNING
Keep learning for free.
Read the complete lesson, save your notes and pick up where you left off with a free account. No card needed.