function messageHat = find_linearly(C, rSignal)
%linearDecoder performs exhaustive search to find a point in constellation % at minimum distance to received point
[~, nT] = size(rSignal); [~, M] = size(C); messageHat = zeros(1, nT); for iT = 1 : nT RSIGNAL = repmat(rSignal(:, iT), 1, M); % Find distance of received signal to all the points in constellation diff = RSIGNAL - C(:,(1:M)); distance = sum(diff .* conj(diff)); % Find the constellation point at minimum distance to recevied signal [~, messageHat(iT)] = min(distance); end