Você está na página 1de 47

BPSK Modulator

BPSK MODULATOR:
%MATLAB Script for a Binary PSK with two Phases % Clear all variables and close all figures clear all; close all; % The number of bits to send - Frame Length N=input('enter the number of bits to be modulated : N = '); % Generate a random bit stream bit_stream = round(rand(1,N)); % Enter the two Phase shifts - in Radians % Phase for 0 bit P1 = 0; % Phase for 1 bit P2 = pi; % Frequency of Modulating Signal f = 2; %f --> time period % Sampling rate of sine wave - This will define the resolution fs = 100; % Time for one bit t = 0: 1/fs : 1; % This time variable is just for plot time = []; PSK_signal = []; Digital_signal = []; carrier_signal = []; for ii = 1: 1: length(bit_stream) % The Original Digital Signal bit0 = (bit_stream(ii)==0)*zeros(1,length(t)); bit1 = (bit_stream(ii)==1)*ones(1,length(t)); Digital_signal = [Digital_signal (bit0+bit1)]; % The FSK Signal bit0 = (bit_stream(ii)==0)*sin(2*pi*f*t + P1); bit1 = (bit_stream(ii)==1)*sin(2*pi*f*t + P2); PSK_signal = [PSK_signal (bit0+bit1)];

% Generating carrier wave carrier_signal = [carrier_signal (sin(2*pi*f*t))]; time = [time t]; t = t + 1; end % Plot the Original Digital Signal subplot(3,1,1); plot(time,Digital_signal,'r','LineWidth',2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('Original Digital Signal'); axis([0 time(end) -0.5 1.5]); grid on; % Plot the carrier Signal subplot(3,1,2); plot(time,carrier_signal,'g','LineWidth',2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('carrier Signal'); axis([0 time(end) -1.5 1.5]); grid on; % Plot the PSK Signal subplot(3,1,3); plot(time,PSK_signal,'LineWidth',2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('PSK Signal with two Phase Shifts'); axis([0 time(end) -1.5 1.5]); grid on;

BPSK DEMODULATOR CODE:


%=================== %BPSK DEMODULATION %=================== % Clear all variables and close all figures clear all; close all; %get the no. of bits N=input('enter the number of bits to be modulated : N = '); % Generate a random bit stream bit_stream =round(rand(1,N)); % Phase for 1 bit P1 = pi; % Frequency of Modulating Signal fc = 1; %f --> time period % Sampling rate of sine wave - This will define the resoultion fs = 100; % Time for one bit t = 0: 1/fs : 1; % This time variable is just for plot time = []; BPSK_signal = []; Digital_signal = []; carrier_signal=[]; for ii = 1: 1: length(bit_stream) % The input bpsk Signal bit0 = ((bit_stream(ii)==0)*sin(2*pi*fc*t)); bit1 = ((bit_stream(ii)==1)*sin(2*pi*fc*t + P1)); BPSK_signal = [BPSK_signal (bit0 + bit1)]; % Generating carrier wave carrier_signal=[carrier_signal (sin(2*pi*fc*t))] % Check inphase and outphase if (BPSK_signal (bit_stream(ii)==0)& carrier_signal (bit_stream(ii)==0)) %inphase Digital_signal = [Digital_signal (bit_stream(ii)==0)*zeros(1,length(t))]; else %out of phase Digital_signal = [Digital_signal (bit_stream(ii)==1)*ones(1,length(t))];

end time = [time t]; t = t + 1; end % Plot the input BPSK Signal subplot(3,1,1); plot(time,BPSK_signal,'LineWidth',2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('BPSK Signal with two Phase Shifts'); axis([0 time(end) -2.5 2.5]); grid on; % Plot the carrier Signal subplot(3,1,2); plot(time,carrier_signal,'g','LineWidth',2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('carrier Signal'); axis([0 time(end) -1.5 1.5]); grid on; %Plot the Original Digital Signal subplot(3,1,3); plot(time,Digital_signal,'r','LineWidth',2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('Original Digital Signal'); axis([0 time(end) -0.5 1.5]); grid on;

QPSK MODULATION: Matlab code: %MATLAB Script for a Binary PSK with two Phases % Clear all variables and close all figures clear all; close all; % The number of bits to send - Frame Length N=input('enter the number of bits to be modulated : N = '); % Generate a random bit stream bit_stream = round(rand(1,N)); % 4 PHASE SHIFTS P1 = pi/4; %45degrees phase shift P2 = 3/4*pi; %135 degrees phase shift P3 = 5/4*pi; %225 degree phase shift P4 = 7/4*pi; %315 degree phase shift % Frequency of Modulating Signal f = 1; %f --> time period % Sampling rate of sine wave - This will define the resoultion fs = 100;

% Time for one bit t = 0: 1/fs : 1; % This time variable is just for plot time = []; QPSK_signal = []; Digital_signal = []; carrier_signal=[]; for ii = 1: 2: length(bit_stream) jj = ii + 1; %Code for generation of Original Digital Signal Digital_signal = [Digital_signal (bit_stream(ii)==0)*zeros(1,length(t)) + (bit_stream(jj)==1)*ones(1,length(t)) ]; %Code for generation of carrier signal carrier_signal=[carrier_signal (sin(2*pi*f*t))]; %Code for genearting QPSK signal modulated signal if bit_stream(ii)==0 if bit_stream(jj)==0 bit00 = (bit_stream(ii)==0)*sin(2*pi*f*t + P1); QPSK_signal = [QPSK_signal (bit00)];

else bit0 = (bit_stream(ii)==0)*sin(2*pi*f*t + P2); bit1 = (bit_stream(jj)==0)*sin(2*pi*f*t + P2); QPSK_signal = [QPSK_signal (bit0+bit1) ]; end end if bit_stream(ii)==1 if bit_stream(jj)==0 bit1 = (bit_stream(ii)==0)*sin(2*pi*f*t + P3); bit0 = (bit_stream(jj)==0)*sin(2*pi*f*t + P3); QPSK_signal = [QPSK_signal (bit1+bit0) ]; else bit11 = (bit_stream(jj)==1)*sin(2*pi*f*t + P4); QPSK_signal = [QPSK_signal (bit11) ]; end end time = [time t]; t = t + 1; end

% Plot the Original Digital Signal subplot(3,1,1); plot(time,Digital_signal,'r','LineWidth',2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('Original Digital Signal'); axis([0 8 -0.5 1.5]); grid on; % Plot the carrier Signal subplot(3,1,2); plot(time,carrier_signal,'g','LineWidth',2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('carrier Signal'); axis([0 time(end) -1.5 1.5]); grid on; % Plot the QPSK Signal subplot(3,1,3);

plot(time, QPSK_signal,'LineWidth',2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('QPSK Signal with two Phase Shifts'); axis([0 8 -1.5 1.5]); grid on;

QPSK DEMODULATOR: Matlab code: %MATLAB Script for a Binary PSK with two Phases format long; % Clear all variables and close all figures clear all; close all; a=input('enter the number of elements: N = '); N=a; % Generate a random bit stream bit_stream =round(rand(1,N)); % 4 PHASE SHIFTS

P1 = pi/4; %45degrees phase shift P2 = 3/4*pi; %135 degrees phase shift P3 = 5/4*pi; %225 degree phase shift P4 = 7/4*pi; %315 degree phase shift % Frequency of Modulating Signal f = 2; %f --> time period

% Sampling rate of sine wave - This will define the resoultion fs = 100; % Time for one bit t = 0: 1/fs : 1; % This time variable is just for plot time = []; QPSK_signal = []; Digital_signal = []; carrier_signal=[]; for ii = 1: 2: length(bit_stream) jj=ii+1; % Checking for input and carrier wave phase

if bit_stream(ii)==0 if bit_stream(jj)==0 bit00 = (bit_stream(ii)==0)*sin(2*pi*f*t + P1); QPSK_signal = [QPSK_signal (bit00)]; else bit0 = (bit_stream(ii)==0)*sin(2*pi*f*t + P2); bit1 = (bit_stream(jj)==0)*sin(2*pi*f*t + P2); QPSK_signal = [QPSK_signal (bit0+bit1) ]; end end if bit_stream(ii)==1 if bit_stream(jj)==0 bit1 = (bit_stream(ii)==0)*sin(2*pi*f*t + P3); bit0 = (bit_stream(jj)==0)*sin(2*pi*f*t + P3); QPSK_signal = [QPSK_signal (bit1+bit0) ]; else bit11 = (bit_stream(jj)==1)*sin(2*pi*f*t + P4); QPSK_signal = [QPSK_signal (bit11) ]; end

end % Generating carrier wave bit00 = ((bit_stream(ii)==0)*sin(2*pi*f*t)); bit11 = ((bit_stream(ii)==1)*sin(2*pi*f*t )); carrier_signal=[carrier_signal (bit00 + bit11)]; %genearting Digital wave if (QPSK_signal (bit_stream(ii)==0)& carrier_signal (bit_stream(ii)==0)) Digital_signal = [Digital_signal (bit_stream(ii)==0)*zeros(1,length(t))]; else Digital_signal = [Digital_signal (bit_stream(ii)==1)*ones(1,length(t))]; end time = [time t]; t = t + 1; end %Plot the Original Digital Signal subplot(3,1,1); plot(time,Digital_signal,'r','LineWidth',2); xlabel('Time (bit period)'); ylabel('Amplitude');

title('Original Digital Signal'); axis([0 time(end) -0.5 1.5]); grid on; % Plot the carrier Signal subplot(3,1,2); plot(time,carrier_signal,'g','LineWidth',2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('carrier Signal'); axis([0 time(end) -1.5 1.5]); grid on; % Plot the input BPSK Signal subplot(3,1,3); plot(time,QPSK_signal,'LineWidth',2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('QPSK Signal with two Phase Shifts'); axis([0 time(end) -2.5 2.5]); grid on;

LINEAR BLOCK CODE


clc; %getting code word size and block size n = input('Enter the length of codeword: '); length = input('Enter the length of input stream: '); trans_bits = input('Enter the bits (zeros and ones): '); block_size = input('Enter the block size (factor of length): '); % to segment the input stream into blocks %creating message vectors no_of_msg_vectors = 2^block_size; disp('no_of_msg_vectors: ') disp(no_of_msg_vectors) msg_vectors=[]; for i=0:1:no_of_msg_vectors-1 msg_vectors=[msg_vectors ; dec2bin(i,block_size)]; end disp('message vectors are: ') disp(msg_vectors) %generating bits to be transmitted parity_column = n-block_size; temp = parity_column; parity_matrix=[ ]; disp('bits to be transmitted: ') %splitting input string into parity rows for i=1:parity_column:length a1=trans_bits(i:temp); for j=1:i+temp:parity_column parity_matrix = [parity_matrix ; a1]; %M=[M ; dec2bin(i,4)]; end

temp=temp+parity_column; end disp('parity matrix: ') disp(parity_matrix) %generating identity matrix identity_matrix = eye(block_size) %creating generator matrix g_matrix=[ ]; g_matrix= horzcat(parity_matrix, identity_matrix) %generating codeword codewd_matrix=[]; codewd_matrix=msg_vectors*g_matrix; for i=1:1:no_of_msg_vectors for j=1:1:n if mod(codewd_matrix(i,j),2)==0 codewd_matrix(i,j)=0; else codewd_matrix(i,j)=1; end end end codewd_matrix %transmission of a code word selected_word=input('Enter the codeword to be transmitted'); trans_word=codewd_matrix(selected_word,:) copy_trans=trans_word; e_pos=input('Enter the bit position to be changed '); if(copy_trans(1,e_pos)==0) copy_trans(1,e_pos)=1; else

copy_trans(1,e_pos)=0; end %decoding the received word received_word=copy_trans parity_t=parity_matrix' identity_mat1=eye(n-block_size) hamming_matrix=[identity_mat1,parity_t] %Error Detection syndrome=received_word*hamming_matrix'; disp('Transpose of Hamming Matrix: ') disp(hamming_matrix') hamming_transpose=hamming_matrix'; for i=1:1:parity_column if mod(syndrome(i),2)==0 syndrome(i)=0; else syndrome(i)=1; end end syndrome for i=1:1:n if syndrome(1,:)==hamming_transpose(i,:) e_bit =i; %errored bit end end disp('The corrupted bit is ') e_bit %Error Correction if received_word(1,e_bit)==1 received_word(1,e_bit)=0; else received_word(1,e_bit)=1;

end disp('Corrected Code Word'); received_word disp('Original Code word'); trans_word

OUTPUT: Enter the length of codeword: 7 Enter the length of parity stream: 12 Enter the bits (zeros and ones): [1 1 0 0 1 1 1 1 1 0 0 1] Enter the block size (factor of length): 4 no_of_msg_vectors: 16 message vectors are: 0000 0001 0010 0011 0100 0101 0110 0111 1000

1001 1010 1011 1100 1101 1110 1111 parity matrix: 1 0 1 0 1 1 1 0 0 1 1 1

identity_matrix = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

g_matrix = 1 0 1 1 0 1 1 0 0 1 0 0 0 0

1 0

1 0

1 1

0 0

0 0

1 0

0 1

codewd_matrix = 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Enter the codeword to be transmitted 6

trans_word = 0 1 0 0 1 0 1

Enter the bit position to be changed 4 received_word = 0 1 0 1 1 0 1

parity_t = 1 1 0 0 1 1 1 1 1 0 0 1

identity_mat1 = 1 0 0 0 1 0 0 0 1

hamming_matrix = 1 0 0 0 1 0 0 0 1 1 1 0 0 1 1 1 1 1 0 0 1

Transpose of Hamming Matrix:

1 0 0 1 0 1 0

0 1 0 1 1 1 0

0 0 1 0 1 1 1

syndrome = 1 1 0

The corrupted bit is e_bit = 4 Corrected Code Word received_word = 0 1 0 0 1 0 1

Original Code word trans_word = 0 1 0 0 1 0 1

CYCLIC BLOCK CODES


%Non-Systematic Cyclic Code% clc; disp('Non-Systematic Cyclic Code'); % get codeword length n = input('Enter the codeword length: '); disp (n); % get message length k=input('Enter the message length: '); disp (k ); %array to hold binary message word M=[]; %array to hold polynomial message word m=[]; %get message word for i=0:(2^k-1)%16 message words %convert decimal no. to binary values dec_bin=de2bi(i,4,'left-msb'); %store binary message word in array M

M=[M;dec_bin]; %convert binary message to polynomial expression and store it n array m m=[m;poly2sym(dec_bin)]; end disp('polynomial expression for message word'); m %generator polynomial disp('coefficients of generator polynomial') G=cyclpoly(n,k)%[1 0 1 1] disp('generator polynomial expression :') g=poly2sym(G)%1+x+x^3 % initialise array to store codeword C=[]; %generation of polynomial codeword for i=1:(2^k) %multiply the message word with generator polynomial polynomial_codeword=expand(m(i,:)*g(1,:));%c=m(x).g(x) %store the codeword in an array C=[C;polynomial_codeword]; end

disp('polynomial codeword'); C %array to store binary codeword c=[]; codeword_coefficients=[]; disp('coefficients of codeword (deci)') for i=1:1:(2^k) %extraction of coefficients from the polynomial codeword codeword_coefficients =sym2poly(C(i)); %append zeros ,to make codeword length =n if(length( codeword_coefficients)<n+1) code_length=n-length(codeword_coefficients); z=zeros(1,code_length); %append 0s to the codeword codeword_coefficients=[z codeword_coefficients]; end c=[c; codeword_coefficients]; end c disp('coefficients of codeword (bin)')

%modulo 2 operation for i=1:1:(2^k) for j=1:1:n if mod(c(i,j),2)==0 c(i,j)=0; else c(i,j)=1;

end end end c disp('******* TRANSMITTING **********'); t=input('enter the code to be transmitted '); R=c(t,:) original_codeword=R; modify_bit=input ('enter the bit to be modified '); if ((R(1,modify_bit))==0) R(1,modify_bit)=1; else

R(1,modify_bit)=0; end disp('modified codeword'); disp(R); disp(' ****** RECEIVING AND DECODING *******') %parity check matrix H disp('parity check matrix H'); H=cyclgen(n,G) disp('syndrome matrix'); Syndrome=R*H';

for i=1:1:(n-k) if mod(Syndrome(i),2)==0 Syndrome(i)=0; else Syndrome(i)=1;

end end disp(Syndrome)

H_transpose=H' for i=1:n if((Syndrome(1,:))==(H_transpose(i,:))) error_bit=i; end end disp('error bit is:'); disp(error_bit); disp('error pattern matrix') E=eye(n)%generate identity matrix of order n*n ei=[]; disp('error vector from error pattern matrix '); ei=E(error_bit,:) original_codeword Corrected_codeword=xor(R,ei)%c=e xor r OUTPUT OF NON SYSTEMATIC CYCLIC CODES: Non-Systematic Cyclic Code Enter the codeword length: 7 Enter the message length: 4 polynomial expression for message word

m= 0 1 x x+1 x^2 x^2+1 x^2+x x^2+x+1 x^3 x^3+1 x^3+x x^3+x+1 x^3+x^2 x^3+x^2+1 x^3+x^2+x x^3+x^2+x+1

coefficients of generator polynomial G=

generator polynomial expression : g= x^3+x+1 polynomial codeword C= 0 x^3+x+1 x^4+x^2+x x^4+x^2+2*x+x^3+1 x^5+x^3+x^2 x^5+2*x^3+x^2+x+1 x^5+x^3+2*x^2+x^4+x x^5+2*x^3+2*x^2+x^4+2*x+1 x^6+x^4+x^3 x^6+x^4+2*x^3+x+1 x^6+2*x^4+x^3+x^2+x x^6+2*x^4+2*x^3+x^2+2*x+1 x^6+x^4+2*x^3+x^5+x^2 x^6+x^4+3*x^3+x^5+x^2+x+1

x^6+2*x^4+2*x^3+x^5+2*x^2+x x^6+2*x^4+3*x^3+x^5+2*x^2+2*x+1 coefficients of codeword (deci) c= 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 1 1 2 2 1 1 2 2 0 1 0 1 1 2 1 2 1 2 1 2 2 3 2 3 0 0 1 1 1 1 2 2 0 0 1 1 1 1 2 2 0 1 1 2 0 1 1 2 0 1 1 2 0 1 1 2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

coefficients of codeword (bin) c= 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 1 0 1 1 0 1 0 1 0 1 0 0 1 0 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

******* TRANSMITTING **********

enter the code to be transmitted 5 R= 0 1 0 1 1 0 0

enter the bit to be modified 7 modified codeword 0 1 0 1 1 0 1

****** RECEIVING AND DECODING ******* parity check matrix H H= 1 0 0 0 1 0 0 0 1 1 0 1 1 1 1 1 1 0 0 1 1

syndrome matrix 0 1 1

H_transpose = 1 0 0 1 1 0 1 0 0 1 0 0 1 1 1

1 0

1 1

0 1

error bit is: 7 error pattern matrix E= 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1

error vector from error pattern matrix ei = 0 0 0 0 0 0 1

original_codeword = 0 1 0 1 1 0 0

Corrected_codeword = 0 1 0 1 1 0 0

**************************************************************************** **************************************************************************** * **************************************************************************** **************************************************************************** *

%Systematic Cyclic Codes

clc; n = input('Enter the codeword length: '); disp (n); k=input('Enter the message length: '); disp (k ); M=[]; m=[]; %array to store binary message word %array to store polynomial message word % get message length % get codeword length

%get message word for i=0:(2^k-1) decimal_to_binary=de2bi(i,4,'left-msb'); %convert binary to decimal M=[M;decimal_to_binary]; %store the binary message word m=[m;poly2sym(decimal_to_binary)]; %store the polynomial message word end

disp('polynomial messageword'); m %X term.. x=[1 0 0 0];% x^(n-k) disp('numerator X term'); X=poly2sym(x); %generator polynomial-denominator Generator_polynomial=cyclpoly(n,k); disp('generator polynomial'); g=poly2sym(Generator_polynomial) numerator_polynomial=[]; %array to store polynomial numerator %numerator in polynomial for i=1:(2^k) %multiply the message word with X^(n-k) num=expand(m(i,:)*X(1,:));%c=m(x).X(x) numerator_polynomial=[numerator_polynomial;num]; %store the codeword in an array end numerator_polynomial c=[]; %array to store numerator inbinary

numerator=[]; num_coefficient=[]; for i=1:1:(2^k) %extraction of coefficients from the polynomial numerator num_coefficient =sym2poly(numerator_polynomial(i)); %append zeros ,to make numerator length =n if(length(num_coefficient)<n+1) code_length=n-length(num_coefficient); z=zeros(1,code_length); num_coefficient=[z num_coefficient]; end numerator=[numerator;num_coefficient];%store the coefficients in an array end numerator g=cyclpoly(n,k); %generator polynomial-denominator disp('generator polynomial-denominator'); Generator_polynomial=poly2sym(g) b=[]; %array to store the remainder %division for i=1:2^k

[q,r]=deconv(numerator(i,:),g); % divide X(x).m(x)/g(x) b=[b;r]; end %modulo -2-operation for i=1:2^k for j=1:1:7 if mod(b(i,j),2)==0 b(i,j)=0; else b(i,j)=1; end end end disp('b(x)'); b %add b(x) with X(x).M(x) disp('codeword'); c=[]; for i=1:2^k codeword=xor(numerator(i,:),b(i,:)); %append the b(x) with m(x).g(x)

c=[c;codeword]; end c disp('****TRANSMITTING****') t=input('enter the code to be transmitted'); R=c(t,:) r=R; b=input ('enter the bit to be modified'); if ((R(1,b))==0) R(1,b)=1; else R(1,b)=0; end disp('modified codeword'); disp(R); disp('****RECEIVING AND DECODING****') disp('parity check matrix '); H=cyclgen(n,g) %syndrome matrix S=R*H';

for i=1:(n-k) if mod(S(i),2)==0 S(i)=0; else S(i)=1; end end disp('syndrome'); disp(S); disp('transpose(H)'); h=H' for i=1:n if((S(1,:))==(h(i,:))) e=i; end end disp('error bit is:'); disp(e); disp('error pattern matrix') E=eye(n)

ei=[]; ei=E(e,:) disp('original codeword') r disp('corrected codeword') C1=xor(R,ei) OUTPUT: Enter the codeword length: 7 7 Enter the message length: 4 4 polynomial messageword m= 0 1 x x+1 x^2 x^2+1 x^2+x

x^2+x+1 x^3 x^3+1 x^3+x x^3+x+1 x^3+x^2 x^3+x^2+1 x^3+x^2+x x^3+x^2+x+1 numerator X term generator polynomial g= x^3+x+1 numerator_polynomial = 0 x^3 x^4 x^4+x^3 x^5 x^5+x^3

x^5+x^4 x^5+x^4+x^3 x^6 x^6+x^3 x^6+x^4 x^6+x^4+x^3 x^6+x^5 x^6+x^5+x^3 x^6+x^5+x^4 x^6+x^5+x^4+x^3 numerator = 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

1 1 1 1 1 1 1

0 0 0 1 1 1 1

0 1 1 0 0 1 1

1 0 1 0 1 0 1

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

generator polynomial-denominator Generator_polynomial = x^3+x+1 b(x) b= 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 1 1 0 1 0 0 1 0 1 0 1 1 0 1 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

1 1 0 0 0 0 1 1

0 1 1 0 1 0 0 1

1 0 1 0 0 1 0 1

codeword c= 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 1 0 1 0 1 0 1 0 1 0 0 1 1 1 1 0 0 1 1 0 1 1 0 1 0 0 1 0 1 0 1 0 1 1 0 1 0 1 0

1 1 1 1 1 1

0 0 1 1 1 1

1 1 0 0 1 1

0 1 0 1 0 1

0 0 0 0 1 1

1 0 1 0 0 1

1 0 0 1 0 1

****TRANSMITTING**** enter the code to be transmitted 7 R= 0 1 1 0 0 0 1

enter the bit to be modified 5 modified codeword 0 1 1 0 1 0 1

****RECEIVING AND DECODING**** parity check matrix H= 1 0 0 0 1 0 0 0 1 1 0 1 1 1 1 1 1 0 0 1 1

syndrome 1 1 1

transpose(H) h =1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 1

error bit is: 5 error pattern matrix E= 1 0 0 0 0 0 0 ei = 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1

original codeword r= 0 1 1 0 0 0 1

corrected codeword C1 = 0 1 1 0 0 0 1

Você também pode gostar