How do I add a custom transfer function to the neural network transfer function library in Neural Network Toolbox R2013b?

15 views (last 30 days)
I would like to know how to add a custom transfer function to the neural network transfer function library.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Oct 2013
You can add your custom transfer function to the Neural Network Transfer Function Block library by using one of the following two methods:
  • Note: Make sure your transfer function.m file meets the requirements given in the Custom Networks section of the Neural Networks User's Guide.
Method A - Graphical Method
1. Type "simulink" at the MATLAB command prompt
2. Double click "Neural Network Toolbox", then right click on "Transfer Function" library and select "Open Transfer Function library".
3. Go to Diagram menu and select "Unlock Library". This will make the library editable.
4. Drag the "Interpretted MATLAB Function" block from "Simulink -> User-Defined Function" in the Simulink Library to this library window.
5. Double click on the "Interpretted MATLAB Function" block, enter the name of your transfer function in the "MATLAB Function" box, then hit OK.
6. Click File/save in the neural/Transfer Function window.
Method B - From the command line
1. Create the following function:
function add_trfcn(fname)
open_system('neural');
open_system('neural/Transfer Functions');
set_param('neural','Lock','off')
add_block('simulink/User-Defined Functions/Interpreted MATLAB Function',['neural/Transfer' char(13) 'Functions/',fname], 'matlabfcn',fname,'name',fname)
 
2. Call it with the name of your transfer function.
For example:
add_trfcn('mytf')
  1 Comment
Wei Chen
Wei Chen on 6 Jul 2015
Hi, I could not save the transfer function window after running add_trfcn('mytf'). The error information says: error renaming "C:\program files\MATLAB\R2014a\toolbox\nnet\nnet\neural.mdl" to error renaming "C:\program files\MATLAB\R2014a\toolbox\nnet\nnet\neural.mdl.2013b.3". Do you have any idea what is going on here? Thanks!

Sign in to comment.

More Answers (2)

Huang Andong
Huang Andong on 16 Dec 2014
Great and helpful!

amin ya
amin ya on 22 Jul 2018
Error writing failed. Permission denied

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!