Here is the code to normalize a given data set so
that the inputs and targets will fall in the
range [-1,1], using PREMNMX, and the code to train a network
with the normalized data.
p = [-10 -7.5 -5 -2.5 0 2.5 5 7.5 10];
t = [0 7.07 -10 -7.07 0 7.07 10 7.07 0];
[pn,minp,maxp,tn,mint,maxt] = premnmx(p,t);
net = newff(minmax(pn),[5 1],{'tansig' 'purelin'},'trainlm');
net = train(net,pn,tn);
If we then receive new inputs to apply to the trained
network, we will use TRAMNMX to transform them
first. Then the transformed inputs can be used
to simulate the previously trained network. The
network output must also be unnormalized using
POSTMNMX.