load 'xdata.txt';
load 'ydata.txt';

[pn,minp,maxp,tn,mint,maxt] = premnmx(xdata,ydata);

net=newff([-1 1],[10 1],{'logsig', 'purelin'}, 'traincgf');

net = init(net);


a = sim(net,pn);
%net.performFcn='msereg';
%net.performParam.ratio=0.95;
net.trainParam.epochs=2000;
net.trainParam.lr = 50;
net.trainParam.goal = 0.01;
[net tr]=train(net,pn,tn);
a = sim(net,pn);


figure(2)
plot(pn,tn,'g*')
hold on
xp=-1:.01:1;
yp=sim(net,xp);
plot(xp,yp)
