I want to compare each row of distance1 with each row of distance2. If a column in distance1 is less than the same row on distance2. Then s_decoded = -1 else s_decoded =+1.
When running this code, s_decoded is coming with a value of 1×1 instead of a 1×1000. As distacne1 and distance2 are both 1×1000.
% Maximum Likelihood (ML) detection rule
distance1 = abs( y - sqrt(spe_snr)*h*(-1) ); distance2 = abs( y - sqrt(spe_snr)*h*(+1) ); if distance1 < distance2 s_decoded = -1; % sqrt(spe_snr)*h*(-1) is closest to y
else s_decoded = +1; % sqrt(spe_snr)*h*(+1) is closest to y
end
Best Answer