Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dataword=[1 0 0 1];
- divisor=[1 0 1 1];
- l=length(dataword);
- remainder=dataword;
- ag=3; %as we augmented 3 zeros at the end of dataword
- for i=1:4
- if(remainder(1)==1)
- remainder=bitxor(remainder,divisor);
- else
- remainder=bitxor(remainder,[0 0 0 0]);
- end
- if(ag>0)
- remainder=[remainder(2:4) 0];
- else
- remainder=[remainder(2:4)];
- end
- ag=ag-1;
- end
- codeword=[dataword remainder]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement