Step 4:
clear;W1=rand(4,2); %assign random weights to connections between input and hidden layers
W2=rand(1,4); %assign random weights to connections between hidden and output layers
for epoch=1:10000 %start training the network
[W1
W2] = BackpropXOR(W1,W2,X,D); %each epoch produces W1 and W2
matrices that are a little closer to the final values of the weights
end; %for epoch
%at the end of the 10,000 epochs, your network is trained