I trained a neural network of 1-2-1 configuration with a cos wave from 0:0.1:2*pi, assigning the nftool option for number of hidden neurons a value of 2. I saved the network into workspace as net1:
After that I changed the weights as:
net1.IW{1,1}=[1 5]'; net1.b{1,1}=[2 2]'; net1.LW{2,1}=[4 8]; net1.b{2,1}=7;
I didn't make any other changes to the network.
Then I executed the following code to check whether I had rightly understood the architecture of the NN:
sum(tansig(0.*net1.IW{1,1}'+net1.b{1,1}').*net1.LW{2,1})+net1.b{2,1} sim(net1,0);
However, the two lines gave me different results.
ans =
18.5683
ans =
2.0855
Shouldn't the results of the last two lines be the same? Is something wrong with the toolbox or have I misunderstood the architecture of the generated network?
Best Answer