%NRZ-L encoding function y = nrzl_enc(x) for i=1:length(x) if x(i) == 0 temp(i) = 1; elseif x(i) == 1 temp(i) = -1; end end y = temp;