{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ProakisSalehi_9.30MATLABSolution

# ProakisSalehi_9.30MATLABSolution - clear all clc n k m P G...

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

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) disp(sprintf('c%i = %s',i,despace(num2str(c(i,:))))) end disp(sprintf('\nSTANDARD ARRAY:')) disp(standard_array) disp(sprintf('\nThe received codeword was found in c%d e%d of the standard array.', cw, e)) disp(sprintf('The decoded codeword is c%d = %s', cw, despace(num2str(c(11,:)))))

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

View Full Document
***************************************************** *************** EXERCISE 9.30 OUTPUT **************** VALID CODEWORDS: c1 = 0000000 c2 = 0001101 c3 = 0010111 c4 = 0011010 c5 = 0100110
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern