function setuppics

%this function initializes the network and defines the patterns

global Nunits nodes synapses Npatterns patterns

Nunits = 400;
nodes = zeros(Nunits,1); %activation vector
synapses = zeros(Nunits,Nunits); %weight matrix
Npatterns = 9; %number of patterns to train on
patterns = zeros(Nunits,Npatterns); %pattern values; unit by pattern

figure(1)
hold on
axis([1 sqrt(Nunits) 1 sqrt(Nunits)]) %patterns are meant to be displayed in a square arrangement (20x20)

%define the patterns, as 1s and -1s

%pattern 1: butterfly
patterns(1:20,1) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(21:40,1) = [1 1 -1 -1 -1 1 1 1 1 1 1 1 1 1 1 -1 -1 -1 1 1]';
patterns(41:60,1) = [1 -1 1 1 -1 -1 1 1 1 -1 -1 1 1 1 -1 -1 1 1 -1 1]';
patterns(61:80,1) = [1 -1 1 -1 1 1 -1 1 1 -1 -1 1 1 -1 1 1 -1 1 -1 1]';
patterns(81:100,1) = [1 -1 1 -1 -1 -1 1 -1 1 1 1 1 -1 1 -1 -1 -1 1 -1 1]';
patterns(101:120,1) = [1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 -1 1]';
patterns(121:140,1) = [1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1]';
patterns(141:160,1) = [1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(161:180,1) = [1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(181:200,1) = [1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(201:220,1) = [1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 1]';
patterns(221:240,1) = [1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 1]';
patterns(241:260,1) = [1 1 1 1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 1 1 1]';
patterns(261:280,1) = [1 1 1 -1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 -1 1 1 1]';
patterns(281:300,1) = [1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(301:320,1) = [1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(321:340,1) = [1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 1]';
patterns(341:360,1) = [1 1 1 1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 1 1 1]';
patterns(361:380,1) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(381:400,1) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';

%pattern 2: tree (mushroom cloud?)
patterns(1:20,2) = [1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 1]';
patterns(21:40,2) = [1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 1 1 1]';
patterns(41:60,2) = [1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1]';
patterns(61:80,2) = [1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(81:100,2) = [1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(101:120,2) = [1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(121:140,2) = [1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1]';
patterns(141:160,2) = [1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1]';
patterns(161:180,2) = [1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 1 1]';
patterns(181:200,2) = [1 1 1 1 -1 -1 1 -1 -1 -1 -1 1 1 1 1 1 1 1 1 1]';
patterns(201:220,2) = [1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1 1]';
patterns(221:240,2) = [1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1 1]';
patterns(241:260,2) = [1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1 1]';
patterns(261:280,2) = [1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1 1]';
patterns(281:300,2) = [1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1 1]';
patterns(301:320,2) = [1 1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 1 1]';
patterns(321:340,2) = [1 1 1 1 1 1 1 1 -1 -1 -1 -1 -1 1 1 1 1 1 1 1]';
patterns(341:360,2) = [1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 1]';
patterns(361:380,2) = [1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1]';
patterns(381:400,2) = [-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]';

%pattern 3: smiley face
patterns(1:20,3) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(21:40,3) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(41:60,3) = [1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 1 1 1]';
patterns(61:80,3) = [1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 1]';
patterns(81:100,3) = [1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1]';
patterns(101:120,3) = [1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 1 1]';
patterns(121:140,3) = [1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 1 1]';
patterns(141:160,3) = [1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 1]';
patterns(161:180,3) = [1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(181:200,3) = [1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(201:220,3) = [1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(221:240,3) = [1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(241:260,3) = [1 1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1]';
patterns(261:280,3) = [1 1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 1]';
patterns(281:300,3) = [1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 1]';
patterns(301:320,3) = [1 1 1 1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 1 1 1]';
patterns(321:340,3) = [1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 1]';
patterns(341:360,3) = [1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 1 1 1]';
patterns(361:380,3) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(381:400,3) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';

%pattern 4: peace
patterns(1:20,4) = [1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1]';
patterns(21:40,4) = [1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 1]';
patterns(41:60,4) = [1 1 -1 -1 -1 1 1 1 1 1 1 1 1 1 1 -1 -1 -1 1 1]';
patterns(61:80,4) = [1 -1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 1]';
patterns(81:100,4) = [-1 -1 -1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1]';
patterns(101:120,4) = [-1 -1 1 1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 1 1 -1 -1]';
patterns(121:140,4) = [-1 -1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 -1 -1]';
patterns(141:160,4) = [-1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1]';
patterns(161:180,4) = [-1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1]';
patterns(181:200,4) = [-1 1 1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 -1 1 1 -1]';
patterns(201:220,4) = [-1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 -1]';
patterns(221:240,4) = [-1 1 1 -1 -1 -1 1 1 -1 1 1 -1 1 1 -1 -1 -1 1 1 -1]';
patterns(241:260,4) = [-1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1]';
patterns(261:280,4) = [-1 -1 1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 1 -1 1 -1 -1]';
patterns(281:300,4) = [-1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 -1]';
patterns(301:320,4) = [-1 -1 -1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1]';
patterns(321:340,4) = [1 -1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 1]';
patterns(341:360,4) = [1 1 -1 -1 -1 1 1 1 1 1 1 1 1 1 1 -1 -1 -1 1 1]';
patterns(361:380,4) = [1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 1]';
patterns(381:400,4) = [1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1]';

%pattern 5: bunny
patterns(1:20,5) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(21:40,5) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(41:60,5) = [1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 1 1]';
patterns(61:80,5) = [1 1 1 1 1 1 1 -1 -1 -1 1 1 -1 -1 1 1 1 1 1 1]';
patterns(81:100,5) = [1 1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 1]';
patterns(101:120,5) = [1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 1 1]';
patterns(121:140,5) = [1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1]';
patterns(141:160,5) = [1 1 1 1 1 -1 -1 1 -1 -1 -1 1 1 1 1 1 1 1 1 1]';
patterns(161:180,5) = [1 1 1 1 -1 -1 1 -1 -1 -1 1 1 1 1 1 1 1 1 1 1]';
patterns(181:200,5) = [1 1 1 -1 -1 1 -1 -1 -1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(201:220,5) = [1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 1 1 1 1 1 1 -1 -1]';
patterns(221:240,5) = [1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 1 -1 -1]';
patterns(241:260,5) = [-1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1]';
patterns(261:280,5) = [-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(281:300,5) = [1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1]';
patterns(301:320,5) = [1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1]';
patterns(321:340,5) = [1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1]';
patterns(341:360,5) = [1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(361:380,5) = [1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1]';
patterns(381:400,5) = [1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1]';

%pattern 6: HI
patterns(1:20,6) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(21:40,6) = [-1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1]';
patterns(41:60,6) = [-1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1]';
patterns(61:80,6) = [1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1]';
patterns(81:100,6) = [1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1]';
patterns(101:120,6) = [1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1]';
patterns(121:140,6) = [1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1]';
patterns(141:160,6) = [1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1]';
patterns(161:180,6) = [1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1]';
patterns(181:200,6) = [1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1]';
patterns(201:220,6) = [1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1]';
patterns(221:240,6) = [1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1]';
patterns(241:260,6) = [1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1]';
patterns(261:280,6) = [1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1]';
patterns(281:300,6) = [1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1]';
patterns(301:320,6) = [1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1]';
patterns(321:340,6) = [1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1]';
patterns(341:360,6) = [-1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1]';
patterns(361:380,6) = [-1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1]';
patterns(381:400,6) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';

%pattern 7: heart
patterns(1:20,7) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(21:40,7) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(41:60,7) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(61:80,7) = [1 1 1 -1 -1 -1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 1 1]';
patterns(81:100,7) = [1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1]';
patterns(101:120,7) = [1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1]';
patterns(121:140,7) = [1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]';
patterns(141:160,7) = [1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]';
patterns(161:180,7) = [1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]';
patterns(181:200,7) = [1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]';
patterns(201:220,7) = [1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1]';
patterns(221:240,7) = [1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(241:260,7) = [1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1]';
patterns(261:280,7) = [1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1]';
patterns(281:300,7) = [1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 1]';
patterns(301:320,7) = [1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 1 1]';
patterns(321:340,7) = [1 1 1 1 1 1 1 1 -1 -1 -1 -1 -1 1 1 1 1 1 1 1]';
patterns(341:360,7) = [1 1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1]';
patterns(361:380,7) = [1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1]';
patterns(381:400,7) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';

%pattern 8: superman
patterns(1:20,8) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(21:40,8) = [1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1]';
patterns(41:60,8) = [1 1 -1 -1 -1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 1 1]';
patterns(61:80,8) = [1 -1 -1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 1]';
patterns(81:100,8) = [-1 -1 -1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1]';
patterns(101:120,8) = [-1 -1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]';
patterns(121:140,8) = [-1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]';
patterns(141:160,8) = [-1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]';
patterns(161:180,8) = [-1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 -1 -1 -1]';
patterns(181:200,8) = [-1 -1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 -1 -1]';
patterns(201:220,8) = [-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1]';
patterns(221:240,8) = [1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1]';
patterns(241:260,8) = [1 1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 1]';
patterns(261:280,8) = [1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 1 1]';
patterns(281:300,8) = [1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1]';
patterns(301:320,8) = [1 1 1 1 1 -1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1]';
patterns(321:340,8) = [1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 1 1]';
patterns(341:360,8) = [1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 1 1 1]';
patterns(361:380,8) = [1 1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 1 1]';
patterns(381:400,8) = [1 1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 1]';

%pattern 9: frown face
patterns(1:20,9) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(21:40,9) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(41:60,9) = [1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 1 1 1]';
patterns(61:80,9) = [1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 1]';
patterns(81:100,9) = [1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1]';
patterns(101:120,9) = [1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 1 1]';
patterns(121:140,9) = [1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 1 1]';
patterns(141:160,9) = [1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 1]';
patterns(161:180,9) = [1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(181:200,9) = [1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(201:220,9) = [1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(221:240,9) = [1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(241:260,9) = [1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1]';
patterns(261:280,9) = [1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 1]';
patterns(281:300,9) = [1 1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 1]';
patterns(301:320,9) = [1 1 1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 1 1 1]';
patterns(321:340,9) = [1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 1]';
patterns(341:360,9) = [1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 1 1 1]';
patterns(361:380,9) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
patterns(381:400,9) = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
