3.33333

3.3 | 15 ratings Rate this file 151 downloads (last 30 days) File Size: 474 Bytes File ID: #14275

CRC code generator

by Nawaz Satvilkar

 

14 Mar 2007 (Updated 14 Mar 2007)

Code covered by BSD License  

Code generates CRC code for any binary data stream & generator polynomial

Download Now | Watch this File

File Information
Description

The standard polynomials are not used to make it more flexible.
User provide data stream and generator polynomial.

Required Products Communications Toolbox
MATLAB release MATLAB 7.0.4 (R14SP2)
Zip File Content  
Other Files crc9.m,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (18)
15 Mar 2007 Jos x@y.z

How do ever expect someone to use this code succesfully if you do not provide any help whatsoever.

Moreover, this is a script that may override existing variables ...

23 May 2007 Ahmad Wazzi

Easy to follow. For the previous comment, please understand how CRC is done and you will find the code straight forward. Code is self explanatory.

24 May 2007 daty daty

I need CRC-32 in my simulations.
Should I take this script and change
the generator polynomial to find it ??

27 Jun 2007 sundas zahid

yeah the code is good but but it can be modified as to the input can be made real time....

29 Jun 2007 Nicolas Vignale

Daty Daty: Look at http://www.mathworks.com/support/solutions/files/s1-P6U4E/CRC.m

You can modify here the Polynom

21 Aug 2007 jef al

your code can only work if the number of data streams are below 360 bits. any higher bits gives error. using GFCONV method works fine

23 Aug 2007 fred uit vosselaar

good code works fine for me. thanks a lot

25 Sep 2007 mona sherdiwala  
24 Nov 2007 Mohsin Shaikh )  
13 Mar 2008 N Fine

unstable and slow with long input vectors - better do everything above Z(2)

31 Mar 2008 Andrea Silvestri

Maybe the for cycle could be replaced with on single line: r=mod(r,2)

11 May 2008 Rudheesh Raghav

Good Work..

I feel the for loop is not required..

20 May 2008 li ming

hao

23 Jun 2008 Glen Klein

Communication toolbox is not required. Another reviewer (Andrea Silvestri) is right: "the for cycle could be replaced with on single line: r=mod(r,2) "

29 Aug 2008 Jo Mateix

Was great! Thanks!

14 Nov 2008 grat c

i used wiki's example to check for its correctness:
http://en.wikipedia.org/wiki/Cyclic_redundancy_check#Computation_of_CRC

msg = [1 1 0 1 0 0 1 1 1 0 1 1 0 0]; poly = [1 0 1 1];
the program gives r = 1 0 0

i've also tried to do the XORs by hand...
i found it is indeed 1 0 1, not sure where goes wrong

19 Feb 2009 Jochen

does not working correct for all generator polynomials, see previous comment.
code needs review. See text bosk or wikipedia for correct (pseudo) code

20 Oct 2009 ATM

grat c> i think your calculation is worng. i hav calculated by hand as well, it gives crc=1 0 0.i think the code is correct.

thanks.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
coding theory Nawaz Satvilkar 22 Oct 2008 09:04:19
information theory Nawaz Satvilkar 22 Oct 2008 09:04:19
crc Nawaz Satvilkar 22 Oct 2008 09:04:19
data stream Nawaz Satvilkar 22 Oct 2008 09:04:19
flexibility Nawaz Satvilkar 22 Oct 2008 09:04:19
polynomials Nawaz Satvilkar 22 Oct 2008 09:04:19
communications Nawaz Satvilkar 22 Oct 2008 09:04:20
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com