//// Letter recognition with threshold perceptron clear; clf; nIn=12*13; nOut=26; wOut=rand(nOut,nIn)-0.5; // training vectors pattern1=read('pattern1',26*12,13); rIn=matrix(pattern1', nIn, 26); rDes=diag(ones(1,26)); // Updating and training network for training_step=1:20; // test all pattern rOut=(wOut*rIn)>0.5; distH=sum(sum((rDes-rOut).^2))/26; errorNet(training_step)=distH; // training with delta rule wOut=wOut+0.1*(rDes-rOut)*rIn'; end plot(0:19,errorNet) xlabel('Training step') ylabel('Average Hamming distance')