Step 7:  

This is the exact same program as that shown in step 6 except that most of the comments have been removed so you can see the entire program without the clutter.  It's a relatively short program.

function [W1, W2] = BackpropXOR(W1,W2,X,D);

alpha=0.9;  
[R C]=size(X);  

for k=1:R  %each row is a training trials.   

    x=X(k,:)'; 
    d=D(k);  
     v1=W1*x; 
    y1=1./(1+exp(-v1));  
    v=W2*y1; 
    y=1./(1+exp(-v));  
     e=d-y; 
    delta=y.*(1-y).*e; 

%****** BACKPROPAGATION  SECTION ******
    e1=W2'*delta; 
    delta1= y1.*(1-y1).*e1; 
    dw1 = alpha*delta1*x'; 
    W1=W1+dw1; 
    dw2=alpha*delta*y1';
    W2=W2+dw2; 

end;