ProakisSalehi_9.30MATLABSolution

ProakisSalehi_9.30MATLABSolution - clear all; clc % % n k m...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
clear all; clc % *************** EXERCISE 9.30 *************** % Define Hamming code parameters n = 7; k = 4; m = n - k; % Create generator, (G) and parity-check, (H) matrices P = [0 1 1; 1 1 0; 1 1 1; 1 0 1]; G = [eye(k) P]; H = [P' eye(m)]; % Define all possible received codewords % The 2^k possible n-length codewords are defined by c=xG x = [0 0 0 0; 0 0 0 1; 0 0 1 0; 0 0 1 1; 0 1 0 0; 0 1 0 1; 0 1 1 0; 0 1 1 1; 1 0 0 0; 1 0 0 1; 1 0 1 0; 1 0 1 1; 1 1 0 0; 1 1 0 1; 1 1 1 0; 1 1 1 1]; c = mod(x*G,2); % Create coset leaders e = eye(7); % Create standard array for i=1:2^k for j=1:n standard_array{i,j} = despace(num2str(mod(c(i,:) + e(j,:),2))); end end % Locate received sequence in standard array rx_seq = '1110100'; [cw,e] = find(ismember(standard_array, rx_seq)==1); % DISPLAY EXERCISE 9.30 OUTPUT disp(sprintf('*****************************************************')) disp(sprintf('*************** EXERCISE 9.30 OUTPUT ****************')) disp(sprintf('VALID CODEWORDS:')) for i = 1:length(c)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/05/2008 for the course ELEN E4702 taught by Professor Lazano during the Summer '08 term at Columbia.

Page1 / 2

ProakisSalehi_9.30MATLABSolution - clear all; clc % % n k m...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online