---
title: "CDMA encoding and decoding"
subject: "Wireless Communication"
chapter: 7
key: "semester_7/wireless_communication:cdma-encoding-decoding"
source: https://www.bctengineer.com/q/semester_7/wireless_communication/cdma-encoding-decoding
site: BCT Engineering
---

# CDMA encoding and decoding

Wireless Communication · Chapter 7: Multiple Access in Wireless Communication

- Asked in: 2082 Bhadra, 7 marks; 2079 Chaitra, 8 marks (asked 2 times)
- Video: [CDMA (Code Division Multiple Access)](https://www.youtube.com/watch?v=UzLUJuvNi_U) — Smile and Learn Abhiraj
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/wireless_communication/cdma-encoding-decoding
- Whole chapter: https://www.bctengineer.com/md/semester_7/wireless_communication/chapter-7

## Question

Explain the implementation of CDMA with its encoding part and decoding part with relevant example.

## Short answer

At the transmitter, each data bit (±1) is multiplied by a unique spreading code of N chips, spreading the signal, then modulates the carrier. The receiver correlates the received composite signal with the same code over a bit period, dividing by N to recover the original bit. Orthogonal codes (e.g., Walsh) cancel other users; example: two users with 4-chip codes recover correctly.

## Answer

**CDMA (Code Division Multiple Access)** lets all users transmit at the same time on the same frequency band. Each user is given a unique **spreading code** (PN or Walsh code) that is (nearly) orthogonal to other users' codes. The receiver separates users by correlating with the wanted user's code.

#### Encoding (transmitter)

```text
 data b(t)--(×)--(×)--> to channel  (sum of all users)
  ±1         ^     ^
       code c(t)   carrier cos(ωc t)
       chip rate Rc >> bit rate Rb
```

1. Each data bit is represented as +1 (for 1) or −1 (for 0).
2. Each bit is multiplied by the user's code of N chips, so one bit becomes N chips. Bandwidth spreads by the **processing gain** G = Rc/Rb = N.
3. The spread signal modulates the carrier (BPSK/QPSK) and is transmitted. In the air, all users' signals **add up**.

#### Decoding (receiver)

```text
 r(t)--(×)--(×)--[∫ over Tb, Σ/N]--[decision]--> data
         ^     ^
   cos(ωc t)   c_k(t) (same code, synchronised)
```

1. The received composite signal is down-converted.
2. It is multiplied chip by chip with the wanted user's code and summed over the bit (correlation), then divided by N.
3. Because cᵢ·cᵢ = N and cᵢ·cⱼ = 0 for orthogonal codes, the wanted bit appears as ±1 and the others cancel.
4. A decision device gives 1 if the result > 0 and 0 if < 0.

#### Example

Two users with 4-chip Walsh codes:
- User A code c_A = (+1, −1, +1, −1); A sends bit 1 → +1
- User B code c_B = (+1, +1, −1, −1); B sends bit 0 → −1

```text
 A signal = +1 × c_A = (+1, -1, +1, -1)
 B signal = -1 × c_B = (-1, -1, +1, +1)
 Channel sum r       = ( 0, -2, +2,  0)

 Decode A: r·c_A = 0(+1)+(-2)(-1)+2(+1)+0(-1) = 4
           4/4 = +1  -> bit 1
 Decode B: r·c_B = 0(+1)+(-2)(+1)+2(-1)+0(-1) = -4
           -4/4 = -1 -> bit 0
```

Both users' bits are recovered correctly from the same channel. Check of orthogonality: c_A·c_B = 1 − 1 − 1 + 1 = 0.

In practice (IS-95), Walsh codes separate users in the forward link, long PN codes separate users in the reverse link, and **power control** keeps all signals at equal strength to avoid the near–far problem.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. At the CDMA transmitter, what happens to each data bit?
   A. It is multiplied by the user's N-chip code, giving N chips and processing gain G = Rc/Rb
   B. It is time-delayed
   C. It is sent on its own frequency
   D. It is divided by N
   Answer: A. Multiplying by the code spreads bandwidth by G = Rc/Rb = N. (Key point: Spreading)

2. Why does correlating with the wanted code recover only that user's bit?
   A. Because ci.ci = N and ci.cj = 0 for orthogonal codes
   B. Because all codes are identical
   C. Because other users stop transmitting
   D. Because the carrier differs per user
   Answer: A. The wanted term sums to N (becomes +/-1 after dividing) while orthogonal users cancel. (Key point: Despreading)

3. With cA=(+1,-1,+1,-1), cB=(+1,+1,-1,-1), A sending +1 and B sending -1, what is the channel sum?
   A. (0, -2, +2, 0)
   B. (+2, 0, 0, -2)
   C. (0, 0, 0, 0)
   D. (+2, -2, +2, -2)
   Answer: A. A=(+1,-1,+1,-1) plus B=(-1,-1,+1,+1) gives (0,-2,+2,0). (Key point: Example result)

4. Why is power control used in practical IS-95 CDMA?
   A. To increase the chip rate
   B. To keep all signals at equal strength and avoid the near-far problem
   C. To make codes orthogonal
   D. To reduce processing gain
   Answer: B. Equal received power prevents a near user from swamping distant ones. (Key point: Power control)

## Related in Wireless Communication

- [Short note: Convolutional encoding and decoding](https://www.bctengineer.com/question.md?key=semester_7%2Fwireless_communication%3Aconvolutional-coding) — Wireless Communication, chapter 6
- [Spread spectrum disadvantages; CDMA implementation](https://www.bctengineer.com/question.md?key=semester_7%2Fwireless_communication%3Aspread-spectrum-disadvantages-cdma) — Wireless Communication, chapter 7

## Related in other subjects

- [Weighted Huffman encoding and decoding](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Ahuffman-jasta-lai) — Data Communication, chapter 8
