 w{1}=[1 1 2;1 -1 -1]';nL{1}='tanh';
 w{2}=[1 -1 1;-1 -1 -1; -2 1.5 0.5]';nL{2}='tanh';
 w{3}=[1 1 1/2 1;1 -1 1 -1]';nL{3}='tanh';
 layers=4;
net=perceptrons(layers,w,nL);
x=rand(300,2)*10-5;
net=net.ff(x);
[u v]=net.uv(net,x); % backpropagation
net=net.cal_gW(net,x(10,:));
gradient_check(net,x(10,:));
y=net.a{layers};
plot3(x(:,1),x(:,2),y,'.')