Skip to main content

BER vs SNR from Channel Impulse Response in MATLAB


In this MATLAB code it is described how to calculate 'BER vs SNR' and 'SER vs SNR' from the Channel Impulse Response (CIR)

SER =  Symbol error rate

For a typical communication system, if we transmit the signal x[n], then received signal will be,

y[n] = h[n]*x[n]  + noise

Where, h[n] is channel impulse response and '*' indicates convolution operation


MATLAB Code

clc;
clear all;
close all;

% Channel Impulse Response (CIR)
channel_response = [0.85]; % Example channel impulse response coefficients
%channel_response = [0.8, 0.1];
% Modulation parameters
modulation_order = 4; % QPSK modulation
num_symbols = 1000; % Number of symbols to transmit
num_bits = 1000*log2(modulation_order);

% Signal generation
tx_symbols = randi([0, modulation_order-1], 1, num_symbols);
tx_signal = qammod(tx_symbols, modulation_order);

% Channel simulation
rx_signal = conv(tx_signal, channel_response);

% Add AWGN (Additive White Gaussian Noise)
snr_dB = 0:2:20;
ber = zeros(size(snr_dB));

for i = 1:length(snr_dB)
noise_power = 10^(-snr_dB(i)/10);
rx_noisy_signal = rx_signal + sqrt(noise_power) * randn(size(rx_signal));

% Receiver processing
rx_symbols = qamdemod(rx_noisy_signal, modulation_order);

% BER calculation
a = reshape(de2bi(rx_symbols(1:num_symbols)),[1,num_bits]);
b = reshape(de2bi(tx_symbols),[1,num_bits]);

ber(i) = sum(a ~= b) / num_bits;
ser(i) = sum(rx_symbols(1:1000) ~= tx_symbols) / num_symbols;
end

% Plot BER vs. SNR curve
figure(1);
semilogy(snr_dB, ber, 'o-');
xlabel('SNR (dB)');
ylabel('Bit Error Rate (BER)');
title('BER vs. SNR');

grid on;

% Plot BER vs. SNR curve
figure(2);
semilogy(snr_dB, ser, 'o-');
xlabel('SNR (dB)');
ylabel('Symbol Error Rate (BER)');
title('SER vs. SNR');

grid on;

Output

 
 
 
 
 
 
 
 
Copy the aforementioned MATLAB Code from here 

People are good at skipping over material they already know!

View Related Topics to







Contact Us

Name

Email *

Message *

Popular Posts

BER vs SNR for M-ary QAM, M-ary PSK, QPSK, BPSK, ...(MATLAB Code + Simulator)

Bit Error Rate (BER) & SNR Guide Analyze communication system performance with our interactive simulators and MATLAB tools. 📘 Theory 🧮 Simulators 💻 MATLAB Code 📚 Resources BER Definition SNR Formula BER Calculator MATLAB Comparison 📂 Explore M-ary QAM, PSK, and QPSK Topics ▼ 🧮 Constellation Simulator: M-ary QAM 🧮 Constellation Simulator: M-ary PSK 🧮 BER calculation for ASK, FSK, and PSK 🧮 Approaches to BER vs SNR What is Bit Error Rate (BER)? The BER indicates how many corrupted bits are received compared to the total number of bits sent. It is the primary figure of merit for a...

Power Spectral Density Calculation Using FFT in MATLAB

📘 Overview 🧮 Steps to calculate the PSD of a signal 🧮 MATLAB Codes 📚 Further Reading Power spectral density (PSD) tells us how the power of a signal is distributed across different frequency components, whereas Fourier Magnitude gives you the amplitude (or strength) of each frequency component in the signal. Steps to calculate the PSD of a signal Firstly, calculate the fast Fourier transform (FFT) of a signal. Then, calculate the Fourier magnitude (absolute value) of the signal. Square the Fourier magnitude to get the power spectrum. To calculate the Power Spectral Density (PSD), divide the squared magnitude by the product of the sampling frequency (fs) and the total number of samples (N). Formula: PSD = |FFT|^2 / (fs * N) Sampling frequency (fs): The rate at which the continuous-time signal is sampled (in ...

Constellation Diagrams of ASK, PSK, and FSK (with MATLAB Code + Simulator)

Constellation Diagrams: ASK, FSK, and PSK Comprehensive guide to signal space representation, including interactive simulators and MATLAB implementations. 📘 Overview 🧮 Simulator ⚖️ Theory 📚 Resources Definitions Constellation Tool Key Points MATLAB Code 📂 Other Topics: M-ary PSK & QAM Diagrams ▼ 🧮 Simulator for M-ary PSK Constellation 🧮 Simulator for M-ary QAM Constellation BASK (Binary ASK) Modulation Transmits one of two signals: 0 or -√Eb, where Eb​ is the energy per bit. These signals represent binary 0 and 1. BFSK (Binary FSK) Modulation Transmits one ...

DFTs-OFDM vs OFDM: Why DFT-Spread OFDM Reduces PAPR Effectively (with MATLAB Code)

DFT-spread OFDM (DFTs-OFDM) has lower Peak-to-Average Power Ratio (PAPR) because it "spreads" the data in the frequency domain before applying IFFT, making the time-domain signal behave more like a single-carrier signal rather than a multi-carrier one like OFDM. Deeper Explanation: Aspect OFDM DFTs-OFDM Signal Type Multi-carrier Single-carrier-like Process IFFT of QAM directly QAM → DFT → IFFT PAPR Level High (due to many carriers adding up constructively) Low (less fluctuation in amplitude) Why PAPR is High Subcarriers can add in phase, causing spikes DFT "pre-spreads" data, smoothing it Used in Wi-Fi, LTE downlink LTE uplink (as SC-FDMA) In OFDM, all subcarriers can...

UGC NET Electronic Science Previous Year Question Papers

Home / Engineering & Other Exams / UGC NET 2022 PYQ 📥 Download UGC NET Electronics PDFs Complete collection of previous year question papers, answer keys and explanations for Subject Code 88. Start Downloading UGC-NET (Electronics Science, Subject code: 88) Subject_Code : 88; Department : Electronic Science; 📂 View All Question Papers UGC Net Electronic Science Question Paper With Answer Key Download Pdf [June 2025] with full explanation UGC Net Electronic Science Question Paper With Answer Key Download Pdf [December 2024] UGC Net Paper 1 With Answer Key Download Pdf [Sep 2024] with full explanation UGC Net Electronic Science Question Paper With Answer Key Download Pdf [Aug 2024] with full explanation UGC Net Paper 1 With Answer Key Download...

ASK, FSK, and PSK (with MATLAB + Online Simulator)

📘 ASK Theory 📘 FSK Theory 📘 PSK Theory 📊 Comparison 🧮 MATLAB Codes 🎮 Simulator ASK or OFF ON Keying ASK is a simple (less complex) Digital Modulation Scheme where we vary the modulation signal's amplitude or voltage by the message signal's amplitude or voltage. We select two levels (two different voltage levels) for transmitting modulated message signals. Example: "+5 Volt" (upper level) and "0 Volt" (lower level). To transmit binary bit "1", the transmitter sends "+5 Volts", and for bit "0", it sends no power. The receiver uses filters to detect whether a binary "1" or "0" was transmitted. Fig 1: Output of ASK, FSK, and PSK modulation using MATLAB for a data stream "1 1 0 0 1 0 1 0" ( Get MATLAB Code ) ...

Filter Bank Multicarrier (FBMC)

Filter Bank Multicarrier (FBMC) Filter Bank Multicarrier (FBMC) is an advanced multicarrier modulation technique designed to overcome the spectral inefficiencies and interference issues of OFDM. Motivation: Limitations of OFDM In an OFDM system , the transmitter uses an Inverse Fast Fourier Transform (IFFT) and the receiver uses a Fast Fourier Transform (FFT) to process multiple subcarriers. Each OFDM symbol occupies a duration denoted by T sym . OFDM is a multicarrier modulation technique where a high data-rate stream is divided into multiple parallel low data-rate streams. To mitigate inter-symbol interference (ISI) caused by multipath fading, the total bandwidth B is divided into N narrow sub-bands. However, a major drawback of OFDM is that the subcarrier filters generated by the IFFT/FFT process have poor spectral cont...