clear all close all clc I= [-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; -1,-1,-1,+1,-1,-1; -1,-1,+1,+1,+1,-1; -1,-1,-1,-1,-1,-1] figure(1) hintonw(I) J= [-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; -1,+1,-1,-1,+1,-1; -1,-1,+1,+1,-1,-1; -1,-1,-1,-1,-1,-1] figure(2) hintonw(J) K= [-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; -1,+1,-1,+1,-1,-1; -1,+1,-1,-1,+1,-1; -1,-1,-1,-1,-1,-1] figure(3) hintonw(K) L= [-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; -1,+1,-1,-1,-1,-1; -1,+1,+1,+1,+1,-1; -1,-1,-1,-1,-1,-1] figure(4) hintonw(L) L1 = reshape (I,48,1) L2 = reshape (J,48,1) L3 = reshape (K,48,1) L4 = reshape (L,48,1) P = [L1,L2,L3,L4] whos disp(P) T=eye(4) net=newp(P,T,'hardlim','learnp') net.trainParam.epochs = 50; net=train(net,P,T) disp('Rozmiar macieżrzy wag: ') disp(net.IW) disp('Zawarosc macierzy wag') disp(net.IW{1}) disp('Rozmiar wektora wsp. progowych') disp(net.b) disp('Zawartosc wektowa wsp. progowych') disp(net.b{1}) y=sim(net,P) figure(5) for i=1:4 subplot(1,2,1) hintonw(reshape(P(:,i),8,6)) subplot(1,2,2) hintonw(Y(:,i)) pause() end