new text document

Download New Text Document

If you can't read please download the document

Upload: habeeb-ali

Post on 10-Nov-2015

213 views

Category:

Documents


0 download

DESCRIPTION

t

TRANSCRIPT

%% piece1234.mclear all;clc;x=randint(1,32)L=4;K=8;G =[ 1 1 0 1 1 0 1 1 1 0 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 0 0 1 ];H =[ 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 0 1 1 1 1 ];X=[];y=reshape(x,L,K)';[r1 c1]=size(y);for i=1:c1 z1=y(:,i); l1=length(y(:,i))/4; z2=reshape(y(:,i),4,l1); [r2 c2]=size(z2); z3=[]; for j=1:c2 a=G*z2(:,j); z3=[z3;a]; end z3=z3'; X =[X z3];endX=rem(X,2);X=X';%decodingR =[0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1];[r3 c3]=size(X);Y=[];for i=1:c3 f=X(:,i); l2=length(f)/7; f1=reshape(f,7,l2); [r4,c4]=size(f1); s1=[]; for j=1:c4 s2=R*f1(:,j); s1=[s1;s2]; end s1=s1'; Y=[Y;s1];endY=rem(Y(:),2);%decoding via eeror free[rd cd]=size(X);Y1=[];for i=1:cd F=X(:,i); L2=length(F)/7; F1=reshape(F,7,L2); [rd1,cd1]=size(F1); S1=[]; for j=1:cd1 e=rem(H*F1(:,j),2); Stdec=num2str(e); dec=bin2dec(Stdec); if dec~=0 F1(dec,j)=F1(dec,j)+1; end S2=R*F1(:,j); S1=[S1;S2]; end S1=S1'; Y1=[Y1;S1];endY1=rem(Y1(:),2);