Author Topic: Simulate the network  (Read 317 times)

Offline oldboy

  • Newbie
  • *
  • Posts: 1
  • Matlab Forum
    • View Profile
Simulate the network
« on: October 27, 2010, 09:51:03 PM »
Hi.
I have created a 3 layer neural network using the code below:

Code: [Select]
net=newff(input,target,[100 50],{'logsig','logsig'});
And I have trained it.
Now I want to use it in c# by making a dll, but matlab compiler does not support sim function for simulation. So I have to split the network to it's layers and compute the result by the code below.

Code: [Select]
function results=NumRecog(inputs)

load c:\NumberNet.mat;

iw1=NumberNet.IW{1,1};
lw2=NumberNet.LW{2,1};
lw3=NumberNet.LW{3,2};

b1=NumberNet.b{1};
b2=NumberNet.b{2};
b3=NumberNet.b{3};

l1=tansig(iw1*inputs+b1);
l2=tansig(lw2*l1+b2);
results=purelin(lw3*l2+b3);

end

sim function returns correct answer. But this code does not.
What is the problem?  :-[
Thank You.
Mohsen.

Matlab and SimuLink Development Forum

Simulate the network
« on: October 27, 2010, 09:51:03 PM »