Sign in

username or email:

password:



Not a member?
Forgot your password?

Search code



Search tips

Ads

See Also

Embedded SystemsFPGA

DSP Code Sharing > Repetition code

Repetition code

Language: Scilab

Processor: Not Relevant

Submitted by Senthilkumar R on Mar 28 2012

Licensed under a Creative Commons Attribution 3.0 Unported License

Repetition code


 

This program is used to generate repetition code for the following specifications: number of bits =5, message bit value =1

 
function [G,H,x]=RepetitionCode(n,k,m)

//Repetition Codes
//n =block of identical 'n' bits
//k =1 one bit
//m = 1;// bit value = 1
I = eye(n-k,n-k);//Identity matrix
P = ones(1,n-k);//coefficient matrix
H = [I P'];//parity-check matrix
G = [P 1];//generator matrix
x = m.*G; //code word
disp(G,'generator matrix');
disp(H,'parity-check matrix');
disp(x,'code word for binary one input');
endfunction
//Result
//-->exec('C:\Users\SENTHILKUMAR\Desktop\Communication_Toolbox\Digital_Communication\RepetitionCode.sci', -1)
//
//-->n = 5
// n  =
//
//    5.  
//
//-->k =1
// k  =
//
//    1.  
//
//-->m =1
// m  =
//
//    1.  
//
//-->[G,H,x]=RepetitionCode(n,k,m)
//
// generator matrix  
//
//    1.    1.    1.    1.    1.  
//
// parity-check matrix  
//
//    1.    0.    0.    0.    1.  
//    0.    1.    0.    0.    1.  
//    0.    0.    1.    0.    1.  
//    0.    0.    0.    1.    1.  
//
// code word for binary one input  
//
//    1.    1.    1.    1.    1.  
// x  =
//
//    1.    1.    1.    1.    1.  
// H  =
//
//    1.    0.    0.    0.    1.  
//    0.    1.    0.    0.    1.  
//    0.    0.    1.    0.    1.  
//    0.    0.    0.    1.    1.  
// G  =
//
//    1.    1.    1.    1.    1.  
 
 
Rate this code snippet:
0
Rating: 0 | Votes: 0
 
   
 
posted by Senthilkumar R



Comments


No comments yet for this code


Add a Comment
You need to login before you can post a comment (best way to prevent spam). ( Not a member? )