Clear Filters
Clear Filters

Related to implementation of Maximum Likelihood Detection in MATLAB

43 views (last 30 days)
Hello all, I am working on research paper in which I have to implement Maximum Likelihood (ML) detection at the receiver. I am interested in plotting Bit error rate (BER) Vs Signal to noise ratio (SNR) plot using semilogy.
Below I am giving the expression of ML detection that I am trying to implement:
--- (1)
where Y is received signal of dimension , is complex Gaussian channel matrix of dimension such that it has zero mean and 10 variance, X is transmitted signal such that and each has dimension and is chosen from set , where has dimension and it denotes the GSSK modulated symbol. The GSSK modulated symbol has value 1 at positions and value 0 at the remaining () positions.
Also, and , where denotes the cardinality of a set. To find the optimal solution
of (1), the complexity of exhaustive search over is too high to implement.
My query is that I am not getting how to implement ML detection (eq. (1)) in MATLAB. I am also sharing the MATLAB code that I had developed for received signal which is given as
----(2)
where Wis additive white Gaussian noise and has dimension .
Any help in this regard will be highly appreciated.
MATLAB code:
N_t = 4; % number of antennas at tag
N_r = 2; % number of antennas at reader
L = 500; % number of observations
n_t = 2; % number of active antennas in GSSK
% Define the GSSK symbols explicitly
GSSK_symbols = [
1 1 0 0;
1 0 1 0;
1 0 0 1;
0 0 1 1;
];
% Total information bits carried by each symbol
M = floor(log2(nchoosek(N_t, n_t)));
% Number of GSSK symbols
N = 2^M;
for snr = 0:3:21 % This is SNR in dB
% Generate the channel matrix H_tr
H_tr = sqrt(10/2) * (randn(N_r, N_t) + 1i*randn(N_r, N_t));
% Generate the transmitted signal X
X = zeros(N_t, L);
for l = 1:L
symbol_idx = randi(N); % randomly choose a symbol index
X(:, l) = GSSK_symbols(symbol_idx, :).';
end
% Generate the noise W
W = (randn(N_r, L) + 1i*randn(N_r, L)) / sqrt(2);
% Calculate the received signal Y
Y = H_tr * X + 10^(-snr/20) * W;
end

Answers (1)

Shashi Kiran
Shashi Kiran about 21 hours ago
I see that you have implemented Generalized Space Shift Keying (GSSK) modulation system model and looking to implement the Maximum Likelihood Detection technique.
Below code is my implementation of the ML detection, which you may find helpful.
% Parameters
N_t = 4; % Number of antennas at tag
N_r = 2; % Number of antennas at reader
L = 100000; % Number of observations
n_t = 2; % Number of active antennas in GSSK
% Define the GSSK symbols explicitly
GSSK_symbols = [
1 1 0 0;
1 0 1 0;
1 0 0 1;
0 0 1 1;
];
% Total information bits carried by each symbol
M = floor(log2(nchoosek(N_t, n_t)));
% Number of GSSK symbols
N = 2^M;
% SNR values in dB
snr_values = -10:3:21;
% Initialize BER array
ber = zeros(size(snr_values));
% Simulation loop over SNR values
for snr_idx = 1:length(snr_values)
snr = snr_values(snr_idx);
num_errors = 0;
total_bits = 0;
% Loop over each observation
for l = 1:L
% Generate the channel matrix H_tr
H_tr = sqrt(10/2) * (randn(N_r, N_t) + 1i*randn(N_r, N_t));
% Randomly choose a symbol index
symbol_idx = randi(N);
X = GSSK_symbols(symbol_idx, :).';
% Generate the noise W
W = (randn(N_r, 1) + 1i*randn(N_r, 1)) / sqrt(2);
% Calculate the received signal Y
Y = H_tr * X + 10^(-snr/20) * W;
% Perform ML Detection
estimated_symbols = ML_Detection_GSSK(H_tr, Y, GSSK_symbols);
% Count bit errors
num_errors = num_errors + sum(symbol_idx ~= estimated_symbols);
total_bits = total_bits + M;
end
% Calculate BER for this SNR value
ber(snr_idx) = num_errors / total_bits;
end
% Plot SNR vs BER
figure;
semilogy(snr_values, ber, '-o');
xlabel('SNR (dB)');
ylabel('Bit Error Rate (BER)');
title('SNR vs BER for GSSK with ML Detection');
grid on;
% Function for ML Detection of GSSK
function [estimated_symbols] = ML_Detection_GSSK(H, y, GSSK_symbols)
N = size(GSSK_symbols, 1); % Number of GSSK symbols
min_distance = Inf; % Initialize the minimum distance as infinity
for k = 1:N
x_k = GSSK_symbols(k, :).'; % k-th GSSK symbol
distance = norm(y - H * x_k)^2; % Euclidean distance
if distance < min_distance
min_distance = distance;
estimated_symbols = k; % Symbol with the minimum distance
end
end
end
Here in the ML detection, I utilized the Euclidean norm to measure the distance between the received symbol and all symbols from the GSSK symbol set. The symbol with the minimum distance is identified and returned by the function. I then compared the index of the detected symbol with the original transmitted signal index, which was generated randomly, and plotted the SNR (Signal to Noise Ratio) vs BER curve.
You may use the following reference
  1. https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=4699782
Hope this gives you an idea and helps you to move further in the implementation.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!