function F = nonlinear_encoding(S)

for i = 1:numel(S)
    if S(i) == 0
        F(i) = 1;
    elseif S(i) == 1
        F(i) = 0;
    elseif S(i) == 2
        F(i) = 3;
    elseif S(i) == 3
        F(i) = 2;
    end
end

end