CRC-5 in MATLAB
-
11-12-2019 - |
Question
How to encode/decode CRC-5-EPC (x^5+x^3+1) in MATLAB?
I've tried:
code = encode(msg,n,k,'cyclic/binary', [1,0,1,0,0,1]);
But it returns:
The generator polynomial P cannot produce a cyclic code generator matrix.
Solution
Maybe you should use crc.generator
(doc) instead of encode
:
h = crc.generator([1,0,1,0,0,1])
code = generate(gen, msg);
OTHER TIPS
From http://www.mathworks.co.uk/help/toolbox/comm/ref/encode.html (emphasis is mine):
code = encode(msg,n,k,'cyclic/fmt',genpoly)
encodesmsg
and creates a systematic cyclic code.genpoly
is a row vector that gives the coefficients, in order of ascending powers, of the binary generator polynomial.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow