**Appendix A**

```
for l = 1:Ntraining;
for i = 1:Nhidden
for j = 1:Ninput
D(i,j) = (Data(l,j)-W(j,i))ˆ2;
end
Distance(i,:) = [sqrt(sum(D(i,:),2)),i];
end
MinDis = min(Distance(:,1));
ONN = find(Distance(:,1) == MinDis);
for i = 1:Nhidden
if i == ONN
HiddenOut(i) = 1;
else
HiddenOut(i) = 0;
end
end
NetOut(l,:) = HiddenOut*V;
if NetOut(l,:) == RealOut(l,:)
W(:,ONN) = W(:,ONN) + Lambda*(transpose(Data(l,:))-W(:,ONN));
else
W(:,ONN) = W(:,ONN)-Lambda*(transpose(Data(l,:))-W(:,ONN));
end
Er(l) = sum(abs(RealOut(l,:)-NetOut(l,:)),2);
end
t = t + 1;
Error(t) = sum(Er,2)
if Error(t) < 500
Lambda = 0.99*Lambda;
End
```