**Appendix B**

```
while Error(l) > Emax
l = l + 1;
Epoch(l) = l;
HO = V0*transpose(InData);
HiddenOut = (1-exp(-A*HO))./(1 + exp(-A*HO));
DiffHiddenOut = (A/2)*(1-HiddenOut.*HiddenOut
HiddenOut(Nshifthidden,:) = 1;
DiffHiddenOut(Nshifthidden,:) =(A/2)*(1-HiddenOut(Nshifthidden,:).*HiddenOut(Nshifthidden,:));
OO = W0*HiddenOut;
Output = (1-exp(-A*OO))./(1 + exp(-A*OO));
DiffOutput = (A/2)*(1-Output.*Output);
DeltaO = (transpose(OutData)-Output).*DiffOutput;
```

```
DeltaH = DiffHiddenOut.*transpose(transpose(DeltaO)*W0);
E = (OutData-transpose(Output)).*(OutData-transpose(Output));for i = 1:Nshifthidden
for j = 1:Nshiftinput
V(i,j) = V0(i,j) + Lambda*DeltaH(i,:)*InData(:,j);
end
end
for i = 1:Nshiftoutput
for j = 1:Nshifthidden
W(i,j) = W0(i,j) + Lambda*DeltaO(i,:)*HiddenOut(j,:)';
end
end
V0 = V;W0 = W;
Error(l) = 0.5*sum(sum(E,1),2);
```