MATLAB Code
%% BER vs SNR for SIMO Communication System
% QPSK modulation
% Single Sensor, Sensor Array, and Vector Sensor (x, y, z axes)
% Maximum Ratio Combining (MRC)
clc;
clear;
close all;
%% PARAMETERS
SNRdB = 0:2:30; % SNR range
Nbits = 1e6; % Large bit count for smooth BER curves
M = 4; % QPSK modulation
k = log2(M);
Nr_cases = [1 3 4]; % Receiver configurations
% 1 = Single Sensor
% 3 = Vector Sensor (x,y,z axes)
% 4 = Sensor Array + Vector Components
BER_sim = zeros(length(Nr_cases), length(SNRdB));
%% GENERATE RANDOM BITS
bits = randi([0 1], Nbits, 1);
%% QPSK MODULATION
symbols = pskmod(bits, M, pi/4, 'InputType','bit');
%% MAIN SIMULATION LOOP
for r = 1:length(Nr_cases)
Nr = Nr_cases(r); % Number of receiving elements
for i = 1:length(SNRdB)
snr = SNRdB(i);
%% CHANNEL MATRIX (Rayleigh fading)
% Represents propagation between transmitter and receiver sensors
h = (randn(Nr,length(symbols)) + 1j*randn(Nr,length(symbols))) / sqrt(2);
%% TRANSMIT SIGNAL THROUGH CHANNEL
tx = repmat(symbols.',Nr,1) .* h;
%% ADD AWGN NOISE
noise = (randn(size(tx)) + 1j*randn(size(tx))) / sqrt(2);
rx = tx + noise*10^(-snr/20);
%% MAXIMUM RATIO COMBINING (MRC)
% Combines signals from multiple sensor elements
combined = sum(conj(h).*rx,1) ./ sum(abs(h).^2,1);
%% QPSK DEMODULATION
detected = pskdemod(combined.', M, pi/4, 'OutputType','bit');
%% BER CALCULATION
[~, BER_sim(r,i)] = biterr(bits, detected);
end
end
%% THEORETICAL BER FOR QPSK
SNRlin = 10.^(SNRdB/10);
BER_theory = qfunc(sqrt(2*SNRlin));
%% PLOT RESULTS (IEEE STYLE)
figure
semilogy(SNRdB, BER_theory,'k-','LineWidth',2)
hold on
markers = {'o','s','d'};
for r=1:length(Nr_cases)
semilogy(SNRdB, BER_sim(r,:), markers{r},...
'LineWidth',1.5,'MarkerSize',8)
end
grid on
xlabel('SNR (dB)')
ylabel('Bit Error Rate (BER)')
title('BER vs SNR for SIMO Communication System (QPSK)')
legend('Theoretical QPSK',...
'Single Sensor',...
'Vector Sensor (x, y, z axes)',...
'Sensor Array + Vector Sensor',...
'Location','southwest')
set(gca,'FontSize',12)
axis([0 30 1e-5 1])
Output