BPSK (Binary Phase Shift Keying), a fundamental digital modulation scheme. A receiver uses a simple technique called Least Squares (LS) Channel Estimation to defeat fading and multipath interference.
Wireless Channel
In this simulation, the channel is designed to be intentionally difficult. It includes two major issues of digital signals:
- Rayleigh Fading: Modeled by
comm.RayleighChannelwith a highMaxDoppler(80 Hz). This causes the signal’s strength and phase to randomly fluctuate rapidly over time, simulating movement. - Multipath Interference (ISI): The
PathDelaysparameter creates a frequency-selective channel. This means the signal arrives at the receiver via multiple paths (reflections off walls, furniture, etc.), resulting in delayed copies of the signal. These delayed copies smear into subsequent symbols, causing Intersymbol Interference (ISI). The Eye Diagram is the canonical tool for visualizing this destructive ISI. - AWGN: Standard thermal noise is added last, completing the corruption.
The Transmission Strategy: The Pilot Block
Since the channel is time-varying, the receiver can’t simply assume the channel is clean. It needs a known reference. The transmitter’s solution is simple: it prefaces every packet of unknown data with a block of known symbols, called Pilots.

These pilots (pilotSym), fixed at the value +1 for BPSK, act like a measuring stick. The receiver knows they should arrive as +1, so any deviation is due to the channel.
LS Estimation and ZF Equalization
This is the core of the signal recovery process, broken down into two essential steps:
1. Least Squares (LS) Channel Estimation
The receiver extracts the received pilot symbols (rxPilot) and performs a simple division (the Least Squares solution) to estimate the average channel distortion:
Hest=mean(XpilotYpilot) (where Xpilot=+1)
The resulting Hest (Hest) is a single complex number that captures the average phase shift and amplitude scaling applied to the packet by the channel.
Why a single average? This “Block-Average” method is simple: it assumes the channel is relatively constant over the short pilot block and the subsequent data block. This is often true for slow-moving systems but struggles severely against the high ISI in this simulation.
2. Zero-Forcing (ZF) Equalization
The estimated distortion (Hest) is then used to “undo” the damage on the unknown data block (rxData):
rxEq=HestrxData
This simple division, known as Zero-Forcing Equalization, attempts to bring the scattered received symbols back onto their ideal BPSK positions (+1 or −1). The final rxEq vector is what the demodulator uses to make decisions.
The BPSK simulation code follows a logical, seven-step process that mirrors the signal chain in a real digital communication system.
The overall purpose of these parameters is to configure a realistic model of a radio channel, specifically a fading multi-path channel.
- The system sends a packet of 1800 symbols.
- The first 200 symbols are used for channel estimation and equalization (Pilots).
- The signal quality is set by 18 dB SNR.
- The signal travels through 6 different paths, each with a different delay (causing ISI) and a different strength (e.g., the last path is 15 dB weaker).

Packet Generation (Transmitter)
1. Generating Pilot Symbols
pilotSym = ones(Np,1);- Action: This generates an array of pilot symbols where every element is set to +1.
- Context:
Np(200, from the previous section) defines the length of this array. - Purpose: The pilot symbols are known to both the transmitter and the receiver. Setting them to +1 is a simple way to create a known sequence. The receiver uses this sequence to estimate the characteristics of the channel (like fading and phase shifts).
2. Generating Data Symbols
dataBits = randi([0 1], Ndata, 1);- Action: This generates a column vector of random data bits, which are either 0 or 1.
- Context:
Ndata(1600) defines the length of the data payload.
dataSym = 2*dataBits - 1;- Action: This performs BPSK (Binary Phase Shift Keying) modulation on the data bits.
- Process:
- If
dataBitsis 0, then 2(0)−1=−1. - If
dataBitsis 1, then 2(1)−1=+1.
- If
- Purpose: It maps the binary data (0 and 1) into complex symbols (+1 and −1) that are ready to be transmitted over the radio channel.
3. Assembling the Transmitted Packet
txPacket = [pilotSym; dataSym];- Action: This creates the final transmitted packet by concatenating the pilot symbols and the data symbols.
- Structure: The packet structure is 200 Pilot symbols followed immediately by 1600 Data symbols, resulting in a total length of Nsym=1800 symbols.
- Purpose: This combined vector,
txPacket, is the sequence of symbols that will be passed through the simulated wireless channel in the next steps of the overall simulation.

Rayleigh Channel Configuration
1. General Settings
chan = comm.RayleighChannel(...)- Action: Creates an instance of the
RayleighChannelsystem object. Rayleigh fading is used to model non-line-of-sight propagation where the signal arrives via multiple reflected paths, resulting in rapid fluctuations in signal strength.
- Action: Creates an instance of the
'SampleRate', SampleRate, ...- Value: 10×106 samples/second.
- Purpose: Sets the discrete-time sampling rate for the simulation, matching the parameter set in the first code snippet.
'NormalizePathGains', true, ...- Purpose: Ensures that the average power gain across all the multi-paths is normalized to unity (1.0), or 0 dB. This simplifies the simulation by ensuring the channel itself does not introduce an overall gain or loss, allowing the input SNR to accurately reflect the desired power ratio.
2. Multi-path (ISI) Settings
'PathDelays', PathDelays/SampleRate, ...- Value: Converts the delays defined in samples (e.g., [0,2,8,…]) into time (seconds) by dividing them by the
SampleRate. - Purpose: Defines the time difference between the arrival of the direct signal and its various reflections, which causes Intersymbol Interference (ISI).
- Value: Converts the delays defined in samples (e.g., [0,2,8,…]) into time (seconds) by dividing them by the
'AveragePathGains', PathGains_dB, ...- Value: [0,−1,−3,−7,−10,−15] dB.
- Purpose: Defines the average power of each of the delayed multi-paths relative to the first path, modeling how much stronger or weaker each reflection is.
3. Fading and Mobility Settings
'MaximumDopplerShift', MaxDoppler, ...- Value: 80 Hz.
- Purpose: Sets the maximum frequency shift caused by the relative movement between the transmitter and receiver. A higher Doppler shift means the channel conditions change faster, leading to faster fading.
'DopplerSpectrum', doppler('Jakes'), ...- Purpose: Specifies the mathematical model used to generate the fading process. The Jakes model (or Jakes spectrum) is a classic and widely used model that accurately represents the statistical distribution of the received signal power in a mobile cellular environment with rich scattering.

Channel Estimation (Least Squares – LS)
This step uses the known pilot symbols to calculate an estimate of the average channel distortion.
rxPilot = rxPacket(1:Np);- Action: Extracts the first
Np(200) received symbols from the total received packet, which correspond to the portion where the known pilot symbols were transmitted. - Context: This is the received signal segment Ypilot.
- Action: Extracts the first
Hest = mean(rxPilot ./ pilotSym);- Action: Calculates the Least Squares (LS) estimate of the channel gain, Hest.
- Principle: In the time domain, the received signal Y is approximately equal to the transmitted signal X multiplied by the channel gain H, plus noise N: Y=XH+N.
- LS Calculation: The estimate of the channel gain is found by dividing the received pilot symbols by the known transmitted pilot symbols: Hest≈Ypilot/Xpilot.
- Simplification: Since the transmitted pilots (
pilotSym) were simply set to +1, the division simplifies to Hest=mean(rxPilot). The averaging (mean) is done to reduce the effect of the AWGN noise on the channel estimate. - Result:
Hestis a single complex number representing the average magnitude attenuation and phase shift applied by the channel across the packet duration.
Equalization (Zero-Forcing – ZF)
This step uses the estimated channel gain to correct the distortion in the received data symbols.
rxData = rxPacket(Np+1:end);- Action: Extracts the remaining received symbols (from sample 201 to the end), which correspond to the data payload.
- Context: This is the received signal segment Ydata.
rxEq = rxData ./ Hest;- Action: Performs Zero-Forcing (ZF) Equalization.
- Principle: The receiver attempts to invert the effect of the channel by dividing the received data symbols by the estimated channel gain: Xestimated=Ydata/Hest.
- Effect: This process ‘undoes’ the average attenuation and phase shift caused by the channel.
- Result:
rxEqis a vector of equalized symbols. If the estimation and equalization were perfect, these symbols would be very close to the ideal BPSK values of +1 or -1.
This simple LS-ZF approach provides basic channel correction, but it only corrects for the average channel gain over the entire packet and does not fully address the time-varying nature of the channel (fading) or the frequency-selective distortion caused by ISI.

Demodulation (Decision Making)
rxBits = rxEq > 0;- Action: This is the demodulation or decision-making step, often called slicing.
- Principle: Since the transmitted data used BPSK modulation (mapping 1 to +1 and 0 to −1), the receiver must decide which symbol was intended based on the equalized received symbol (
rxEq). - Decision Rule: For BPSK, the decision boundary is at 0.
- If the real part of the equalized symbol (
rxEq) is positive (>0), the decision is that the original bit was 1. - If the real part is negative (≤0), the decision is that the original bit was 0.
- If the real part of the equalized symbol (
- Result:
rxBitsis a vector of the received, demodulated data bits (0s and 1s).
Error Rate Calculation
BER = mean(rxBits ~= dataBits);- Action: Calculates the Bit Error Rate (BER).
- Process:
rxBits ~= dataBits: This performs a logical comparison between the received bits (rxBits) and the original, known transmitted bits (dataBits). The result is a vector of 1s (where an error occurred) and 0s (where the bits match).mean(...): Taking the average of this error vector directly gives the proportion of bits that were received incorrectly.
- Result:
BERis a single number representing the probability of a bit error in the simulation (e.g., 10−3 means 1 out of 1000 bits were wrong).
