Pages

Saturday, November 12, 2011

Neural Networks in Matlab

p is the input data
e.g. we have two inputs:
x1 = 1 2 1
x2 = 2 3 1

t is the target data
e.g. assume that we want to add our two inputs
t = 3 5 2

>> net=newff(minmax(p),[8,1],{'tansig','purelin'},'traingd');
>> net.trainParam.epochs = 3000;
>> [net,tr]=train(net,p,t);
>> sim(net,p)


If more hidden layers needed, use
>> net=newff(minmax(p),[8,5,1],{'tansig','tansig','purelin'},'traingd');
and so on

No comments:

Post a Comment