Date: Aug 13, 2010 10:47 AM
Author: hasan batuk
Subject: Neural Networks weights and bias help

Hi, i am trying to learn NN toolbox. I tried to creat a networks that multiply the number by 3 and gives as output. For simplicity, i made the transfer function also linear. It works well but i tried to reach the same result by using the bias and weight values.
x -> input
y-> output

a= [ (w1*x + b1) * w2 ]+b2

but it ends up with same as the input value. I am really confused about it. it looks very simple but i couldnt find what i miss. Thanks for your time. the code is below


P=[1:4:200]; % training set
T=P*3; % target set

net=newff(P,T,1);
net.layers{1}.transferFcn = 'purelin'; % making transfer func. as linear

net=train(net,P,T);

y=sim(net,101) % giving a number say 101 as an input to system and taking 303 as output as expected.

% trying to reach same result by using weight and bias values. it ends up with 101, not 303.

a1=(net.iw{1,1}*101)+net.b{1}; % output of first layer

a2=(net.lw{2,1}*a1)+net.b{2} % output of second layer