% Codes
c1 = [1     1     1     1];
c2 = [1     1     -1     -1];
c3 = [1     -1     -1     1];
c4 = [1     -1     1     -1];
% Code matrix
C = [c1; c2; c3; c4];
% Messages. S(i) is the ith user's message.
S = [14 20 26 -5];
%%
noise = 0;
% Receiver receives
r = S*C + noise;
% Alternatively, use
% r = S(1)*c1 + S(2)*c2 + S(3)*c3 + S(4)*c4

% If want to know only the message from user 3, use
S3_hat = 1/4*r*c3'
% If want to know the messages from all users, use
S_hat = 1/4*r*C'