Program 2

# Program 2 - Define digits as vectors...

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

% Define digits as vectors p0=[-1;1;1;1;1;-1;1;-1;-1;-1;-1;1;1;-1;-1; . .. -1;-1;1;1;-1;-1;-1;-1;1;-1;1;1;1;1;-1]; p1=[-1;-1;-1;-1;-1;-1;1;-1;-1;-1;-1;-1;1; . .. 1;1;1;1;1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1]; p2=[1;-1;-1;-1;-1;-1;1;-1;-1;1;1;1;1;-1; . .. -1;1;-1;1;-1;1;1;-1;-1;1;-1;-1;-1;-1;-1;1]; p3=[1;-1;-1;-1;-1;1;1;-1;-1;-1;-1;1;1; . .. -1;-1;1;-1;1;1;-1;-1;1;-1;1;-1;1;1;1;1;-1]; p4=[1;1;1;1;-1;-1;-1;-1;-1;1;-1;-1;-1;-1; . .. -1;1;-1;-1;-1;-1;-1;1;-1;-1;1;1;1;1;1;1]; p5=[-1;-1;-1;-1;-1;-1;1;1;1;-1;-1;1;1;-1;1; . .. -1;-1;1;1;-1;1;-1;-1;1;1;-1;-1;1;1;-1]; p6=[1;1;1;1;1;1;1;-1;-1;1;-1;1;1;-1;-1;1; . .. -1;1;1;-1;-1;1;1;1;-1;-1;-1;-1;-1;-1]; % These vectors represent the columns of the table in the report correct2Hebb = zeros(1,6); correct2Pseudo = zeros(1,6); correct4Hebb = zeros(1,6); correct4Pseudo = zeros(1,6); correct6Hebb = zeros(1,6); correct6Pseudo = zeros(1,6); % Do once for Hebb Rule (rule = 1) and for Pseudoinverse Rule (rule = 2) for rule = 1:2 % For each iteration, include a new digit in input matrix for input = 1:6 if (input == 1) P = [p0 p1]; end if (input == 2) P = [p0 p1 p2]; end if (input == 3) P = [p0 p1 p2 p3]; end if (input == 4) P = [p0 p1 p2 p3 p4]; end if (input == 5) P = [p0 p1 p2 p3 p4 p5]; end if (input == 6) P = [p0 p1 p2 p3 p4 p5 p6];

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

View Full Document
end % Perform Hebb Rule if (rule == 1) W = P * P'; end % Perform Pseudoinverse Rule if (rule == 2) W = P * inv(P' * P) * P'; end % Repeat random pixel change (2, 4, or 6) 10 times
This is the end of the preview. Sign up to access the rest of the document.

## This homework help was uploaded on 04/20/2008 for the course EE 4745 taught by Professor Rai during the Fall '07 term at LSU.

### Page1 / 6

Program 2 - Define digits as vectors...

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

View Full Document
Ask a homework question - tutors are online