Code:
clc;
clear all;
close all;
n=input('enter the code digits');
k=input('enter the data digits');
p=input('enter the parity
matrix it must bei k rows and m coloums'); disp(p)
z=input('enter 1 for systmetic
and 0 for nonsystmetic');
msg=[];
for i=0:2^k-1
    msg=[msg;de2bi(i,k,'left-msb')];
end
if z==1
  %p=[1 0 1;0 1 1;1 1 0];
  i=eye([k k])
  g=[i p]
else 
  g=input('enter the generator matrix in k*n ');  
end    
code =rem(msg*g,2)
decmsg=decode(code ,n,k,'linear',g)







 
 
 
 
 
 
