How to code my own transfer function
2 次查看(过去 30 天)
显示 更早的评论
Hello all,
I am trying to implement my own transfer function that makes the exponential function. I would like then to integrate it in my code. I was inspired by the 'purelin'transfer function present in matlab to code my own exponential function
Here is how i proceed in my main function.
...
net = newff(pn,tn,S1,[],'trainlm');
net.layers{1}.transferFcn = exponential;
net.layers{2}.transferFcn = purelin;
...
And when i do run my code i do have the following error:
??? Error using ==> boiler_transfer at 5 Not enough arguments.
Error in ==> zexponential at 63 boiler_transfer
Error in ==> CorpusParam at 28 net.layers{1}.transferFcn= exponential
Does anyone knows how to fix that problem.
Thank you ,
Souma
0 个评论
回答(3 个)
Walter Roberson
2011-5-12
Assign this transfer function to layer i of a network.
net.layers{i}.transferFcn = 'purelin';
Notice they supplied a quoted string. Without the quotes, the code would attempt to call purelin right then and there and store the result as the transferFcn.
Likewise, since you coded exponential it is going to try to call exponential immediately and store the result -- an attempt that fails because you have no arguments. So use 'exponential' instead. (Though I suspect that using the function handle @exponential would be even better.)
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!