MATLAB Script
clc;
clear;close all;
% SNR range in dB
SNRdB = 0:2:20;
% Convert SNR from dB to linear scale
EbN0Lin = 10.^(SNRdB / 10);
% Theoretical BER for 2x2 Alamouti with BPSK modulation
pAlamouti = 1/2 - 1/2*(1+2./EbN0Lin).^(-1/2);
theoryBerAlamouti_nTx2_nRx1 = pAlamouti.^2.*(1+2*(1-pAlamouti));
% Plot the theoretical BER vs SNR
figure;
semilogy(SNRdB, theoryBerAlamouti_nTx2_nRx1, '*-r', 'LineWidth', 2);
grid on;
xlabel('SNR (dB)');
ylabel('Bit Error Rate (BER)');
title('Theoretical BER vs SNR for 2x2 Alamouti Scheme with BPSK');
legend('Theoretical BER');