How to code my own transfer function
2 views (last 30 days)
Show older comments
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 Comments
Answers (3)
Walter Roberson
on 12 May 2011
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 Comments
See Also
Categories
Find more on Wireless Communications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!