MATLAB: How neural network output is calculated

neural network

For example
function Example_3()
net = feedforwardnet(1);
p = [[2;2] [1;-2] [-2;2] [-1;1]]
t = [1 2 1 2]
net.layers{1}.transferFcn = 'logsig';
net.layers{2}.transferFcn = 'logsig';
net = train(net,p,t);
wb = formwb(net,net.b,net.iw,net.lw);
[b,iw,lw] = separatewb(net,wb);
end
If
iw are -1.60579942154570 and 5.53933429980683
lw is -24.9335783159999
biases are -1.16445538542225 for the hidden neuron
and 7.83599936414935 for the output neuron
I was able able to calculate the correct values when using a perception but not with neural networks for some reason
I calculate the output using logsig(logsig((IW1*Input1)+(IW2*Input2)+bias1)*LW1+bias2)
If I input -1 and 1, how is the output calculated as 1.9994?
Shouldn't the output be between 0 and 1 because of the logsig ?

Best Answer

When you calculate the output of a net you have to take into account that values in the calculations are scaled, by default,
Hope this helps
Thank you for formally accepting my answer
Greg