function [ret,x0,str,ts,xts]=extrnn(t,x,u,flag);
%EXTRNN	is the M-file description of the SIMULINK system named EXTRNN.
%	The block-diagram can be displayed by typing: EXTRNN.
%
%	SYS=EXTRNN(T,X,U,FLAG) returns depending on FLAG certain
%	system values given time point, T, current state vector, X,
%	and input vector, U.
%	FLAG is used to indicate the type of output to be returned in SYS.
%
%	Setting FLAG=1 causes EXTRNN to return state derivatives, FLAG=2
%	discrete states, FLAG=3 system outputs and FLAG=4 next sample
%	time. For more information and other options see SFUNC.
%
%	Calling EXTRNN with a FLAG of zero:
%	[SIZES]=EXTRNN([],[],[],0),  returns a vector, SIZES, which
%	contains the sizes of the state vector and other parameters.
%		SIZES(1) number of states
%		SIZES(2) number of discrete states
%		SIZES(3) number of outputs
%		SIZES(4) number of inputs
%		SIZES(5) number of roots (currently unsupported)
%		SIZES(6) direct feedthrough flag
%		SIZES(7) number of sample times
%
%	For the definition of other parameters in SIZES, see SFUNC.
%	See also, TRIM, LINMOD, LINSIM, EULER, RK23, RK45, ADAMS, GEAR.

% Note: This M-file is only used for saving graphical information;
%       after the model is loaded into memory an internal model
%       representation is used.

% the system will take on the name of this mfile:
sys = mfilename;
new_system(sys)
simver(1.3)
if (0 == (nargin + nargout))
     set_param(sys,'Location',[403,223,685,769])
     open_system(sys)
end;
set_param(sys,'algorithm',     'RK-45')
set_param(sys,'Start time',    '0.0')
set_param(sys,'Stop time',     '999999')
set_param(sys,'Min step size', '0.0001')
set_param(sys,'Max step size', '10')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',   '')

add_block('built-in/Note',[sys,'/',['Neural Net Neuron Layers',13,'(Double click on the "?" for more info)']])
set_param([sys,'/',['Neural Net Neuron Layers',13,'(Double click on the "?" for more info)']],...
		'position',[111,5,116,10])


%     Subsystem  'More Info'.

new_system([sys,'/','More Info'])
set_param([sys,'/','More Info'],'Location',[26,314,526,474])

add_block('built-in/Note',[sys,'/','More Info/Simply connect these layers into a Neural Net.'])
set_param([sys,'/','More Info/Simply connect these layers into a Neural Net.'],...
		'position',[255,10,260,15])

add_block('built-in/Note',[sys,'/','More Info/Input a weight matrix and bias for each layer.'])
set_param([sys,'/','More Info/Input a weight matrix and bias for each layer.'],...
		'position',[258,40,263,45])

add_block('built-in/Note',[sys,'/','More Info/Input eye(n) for layers without weights where n is the number of neurons in the layer.'])
set_param([sys,'/','More Info/Input eye(n) for layers without weights where n is the number of neurons in the layer.'],...
		'position',[253,70,258,75])

add_block('built-in/Note',[sys,'/','More Info/Input 0 for layers without biases for all neurons except Radial basis.'])
set_param([sys,'/','More Info/Input 0 for layers without biases for all neurons except Radial basis.'],...
		'position',[248,100,253,105])

add_block('built-in/Note',[sys,'/','More Info/Input 1 for Radial basis neuron layers without biases.'])
set_param([sys,'/','More Info/Input 1 for Radial basis neuron layers without biases.'],...
		'position',[245,128,250,133])
set_param([sys,'/','More Info'],...
		'Mask Display','?')


%     Finished composite block 'More Info'.

set_param([sys,'/','More Info'],...
		'hide name',0,...
		'Drop Shadow',4,...
		'position',[235,10,262,35])


%     Subsystem  ['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer'].

new_system([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer']])
set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer']],'Location',[215,502,536,725])

add_block('built-in/Relational Operator',[sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/hardlim']])
set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/hardlim']],...
		'position',[210,102,240,133])

add_block('built-in/Outport',[sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/out_1']])
set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/out_1']],...
		'position',[275,110,295,130])

add_block('built-in/Inport',[sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/in_1']])
set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/in_1']],...
		'position',[15,95,35,115])

add_block('built-in/State-Space',[sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/Weight']])
set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/Weight']],...
		'A','[]',...
		'B','[]',...
		'C','[]',...
		'D','K',...
		'Mask Display','W',...
		'Mask Type','Matrix Gain')
set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/Weight']],...
		'Mask Dialogue','Matrix Gain.|Gain matrix:',...
		'Mask Translate','K = @1;')
set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/Weight']],...
		'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
		'Mask Entries','W\/',...
		'position',[60,91,85,119])

add_block('built-in/Sum',[sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/Sum']])
set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/Sum']],...
		'position',[150,100,170,120])

add_block('built-in/Constant',[sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/Bias']])
set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/Bias']],...
		'Value','b',...
		'position',[60,155,80,175])

add_block('built-in/Constant',[sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/0']])
set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer/0']],...
		'Value','0',...
		'position',[155,155,175,175])
add_line([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer']],[245,120;270,120])
add_line([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer']],[40,105;55,105])
add_line([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer']],[90,105;145,105])
add_line([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer']],[85,165;110,165;110,115;145,115])
add_line([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer']],[175,110;205,110])
add_line([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer']],[180,165;190,165;190,125;205,125])
set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer']],...
		'Mask Display','plot(0,0,100,100,[80,20],[90,70],[80,20],[50,50],[80,20],[10,30],[80,20],[50,30],[80,21],[90,30],[80,20],[10,50],[80,21],[91,50],[80,20],[50,70],[80,20],[10,70])')
set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer']],...
		'Mask Type','Neuron layer',...
		'Mask Dialogue','Hard limit (0,1) neuron layer.\nSee hardlim.m in Neural Network Toolbox.|Weight:|Bias:')
set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer']],...
		'Mask Translate','W=@1; b=@2;',...
		'Mask Help','Implements hardlim(W*p,b) where W is the Weight, b is the Bias, and p is the input to the block.')
set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer']],...
		'Mask Entries','W\/b\/')


%     Finished composite block ['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer'].

set_param([sys,'/',['Hard Limit (0,1)',13,'(Perceptron)',13,'Neuron',13,'Layer']],...
		'position',[65,45,95,95])


%     Subsystem  ['Hard Limit (-1,1)',13,'Neuron',13,'Layer'].

new_system([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer']])
set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer']],'Location',[215,502,546,725])

add_block('built-in/Constant',[sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/1']])
set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/1']],...
		'position',[170,50,190,70])

add_block('built-in/Constant',[sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/-1']])
set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/-1']],...
		'Value','-1',...
		'position',[170,155,190,175])

add_block('built-in/Switch',[sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/hardlims']])
set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/hardlims']],...
		'position',[220,94,245,126])

add_block('built-in/Constant',[sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/Bias']])
set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/Bias']],...
		'Value','b',...
		'position',[60,155,80,175])

add_block('built-in/Sum',[sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/Sum']])
set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/Sum']],...
		'position',[150,100,170,120])

add_block('built-in/State-Space',[sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/Weight']])
set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/Weight']],...
		'A','[]',...
		'B','[]',...
		'C','[]',...
		'D','K',...
		'Mask Display','W',...
		'Mask Type','Matrix Gain',...
		'Mask Dialogue','Matrix Gain.|Gain matrix:')
set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/Weight']],...
		'Mask Translate','K = @1;',...
		'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
		'Mask Entries','W\/')
set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/Weight']],...
		'position',[60,91,85,119])

add_block('built-in/Inport',[sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/in_1']])
set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/in_1']],...
		'position',[15,95,35,115])

add_block('built-in/Outport',[sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/out_1']])
set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer/out_1']],...
		'position',[275,100,295,120])
add_line([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer']],[195,165;200,165;200,120;215,120])
add_line([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer']],[195,60;200,60;200,100;215,100])
add_line([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer']],[175,110;215,110])
add_line([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer']],[85,165;110,165;110,115;145,115])
add_line([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer']],[90,105;145,105])
add_line([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer']],[40,105;55,105])
add_line([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer']],[250,110;270,110])
set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer']],...
		'Mask Display','plot(0,0,100,100,[80,20],[90,70],[80,20],[50,50],[80,20],[10,30],[80,20],[50,30],[80,21],[90,30],[80,20],[10,50],[80,21],[91,50],[80,20],[50,70],[80,20],[10,70])')
set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer']],...
		'Mask Type','Neuron layer',...
		'Mask Dialogue','Hard limit (-1,1) neuron layer.\nSee hardlims.m in Neural Network Toolbox.|Weight:|Bias:',...
		'Mask Translate','W=@1; b=@2;')
set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer']],...
		'Mask Help','Implements hardlims(W*p,b) where W is the Weight, b is the Bias, and p is the input to the block.',...
		'Mask Entries','W\/b\/')


%     Finished composite block ['Hard Limit (-1,1)',13,'Neuron',13,'Layer'].

set_param([sys,'/',['Hard Limit (-1,1)',13,'Neuron',13,'Layer']],...
		'position',[190,45,220,95])


%     Subsystem  ['Saturation (0,1)',13,'Neuron',13,'Layer'].

new_system([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer']])
set_param([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer']],'Location',[215,502,546,725])

add_block('built-in/Outport',[sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer/out_1']])
set_param([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer/out_1']],...
		'position',[275,100,295,120])

add_block('built-in/Inport',[sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer/in_1']])
set_param([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer/in_1']],...
		'position',[15,95,35,115])

add_block('built-in/State-Space',[sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer/Weight']])
set_param([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer/Weight']],...
		'A','[]',...
		'B','[]',...
		'C','[]',...
		'D','K',...
		'Mask Display','W',...
		'Mask Type','Matrix Gain',...
		'Mask Dialogue','Matrix Gain.|Gain matrix:')
set_param([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer/Weight']],...
		'Mask Translate','K = @1;',...
		'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
		'Mask Entries','W\/')
set_param([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer/Weight']],...
		'position',[60,91,85,119])

add_block('built-in/Sum',[sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer/Sum']])
set_param([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer/Sum']],...
		'position',[150,100,170,120])

add_block('built-in/Constant',[sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer/Bias']])
set_param([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer/Bias']],...
		'Value','b',...
		'position',[60,155,80,175])

add_block('built-in/Saturation',[sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer/satlin']])
set_param([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer/satlin']],...
		'Lower Limit','0',...
		'Upper Limit','1',...
		'position',[210,100,235,120])
add_line([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer']],[240,110;270,110])
add_line([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer']],[40,105;55,105])
add_line([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer']],[90,105;145,105])
add_line([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer']],[85,165;110,165;110,115;145,115])
add_line([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer']],[175,110;205,110])
set_param([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer']],...
		'Mask Display','plot(0,0,100,100,[80,20],[90,70],[80,20],[50,50],[80,20],[10,30],[80,20],[50,30],[80,21],[90,30],[80,20],[10,50],[80,21],[91,50],[80,20],[50,70],[80,20],[10,70])')
set_param([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer']],...
		'Mask Type','Neuron layer',...
		'Mask Dialogue','Saturation limit (0,1) neuron layer.\nSee satlin.m in Neural Network Toolbox.|Weight:|Bias:')
set_param([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer']],...
		'Mask Translate','W=@1; b=@2;',...
		'Mask Help','Implements satlin(W*p,b) where W is the Weight, b is the Bias, and p is the input to the block.',...
		'Mask Entries','W\/b\/')


%     Finished composite block ['Saturation (0,1)',13,'Neuron',13,'Layer'].

set_param([sys,'/',['Saturation (0,1)',13,'Neuron',13,'Layer']],...
		'position',[65,150,95,200])


%     Subsystem  ['Saturation (-1,1)',13,'Neuron',13,'Layer'].

new_system([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer']])
set_param([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer']],'Location',[215,502,546,725])

add_block('built-in/Saturation',[sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer/satlin']])
set_param([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer/satlin']],...
		'Lower Limit','-1',...
		'Upper Limit','1',...
		'position',[210,100,235,120])

add_block('built-in/Constant',[sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer/Bias']])
set_param([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer/Bias']],...
		'Value','b',...
		'position',[60,155,80,175])

add_block('built-in/Sum',[sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer/Sum']])
set_param([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer/Sum']],...
		'position',[150,100,170,120])

add_block('built-in/State-Space',[sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer/Weight']])
set_param([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer/Weight']],...
		'A','[]',...
		'B','[]',...
		'C','[]',...
		'D','K',...
		'Mask Display','W',...
		'Mask Type','Matrix Gain',...
		'Mask Dialogue','Matrix Gain.|Gain matrix:')
set_param([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer/Weight']],...
		'Mask Translate','K = @1;',...
		'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
		'Mask Entries','W\/')
set_param([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer/Weight']],...
		'position',[60,91,85,119])

add_block('built-in/Inport',[sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer/in_1']])
set_param([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer/in_1']],...
		'position',[15,95,35,115])

add_block('built-in/Outport',[sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer/out_1']])
set_param([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer/out_1']],...
		'position',[275,100,295,120])
add_line([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer']],[175,110;205,110])
add_line([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer']],[85,165;110,165;110,115;145,115])
add_line([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer']],[90,105;145,105])
add_line([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer']],[40,105;55,105])
add_line([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer']],[240,110;270,110])
set_param([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer']],...
		'Mask Display','plot(0,0,100,100,[80,20],[90,70],[80,20],[50,50],[80,20],[10,30],[80,20],[50,30],[80,21],[90,30],[80,20],[10,50],[80,21],[91,50],[80,20],[50,70],[80,20],[10,70])')
set_param([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer']],...
		'Mask Type','Neuron layer',...
		'Mask Dialogue','Satration limit (-1,1) neuron layer.\nSee satlins.m in Neural Network Toolbox.|Weight:|Bias:')
set_param([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer']],...
		'Mask Translate','W=@1; b=@2;',...
		'Mask Help','Implements satlins(W*p,b) where W is the Weight, b is the Bias, and p is the input to the block.')
set_param([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer']],...
		'Mask Entries','W\/b\/')


%     Finished composite block ['Saturation (-1,1)',13,'Neuron',13,'Layer'].

set_param([sys,'/',['Saturation (-1,1)',13,'Neuron',13,'Layer']],...
		'position',[190,150,220,200])


%     Subsystem  ['Log sigmoid',13,'neuron',13,'layer'].

new_system([sys,'/',['Log sigmoid',13,'neuron',13,'layer']])
set_param([sys,'/',['Log sigmoid',13,'neuron',13,'layer']],'Location',[215,502,546,725])

add_block('built-in/S-Function',[sys,'/',['Log sigmoid',13,'neuron',13,'layer/logsig']])
set_param([sys,'/',['Log sigmoid',13,'neuron',13,'layer/logsig']],...
		'function name','logsigc',...
		'position',[200,100,250,120])

add_block('built-in/Outport',[sys,'/',['Log sigmoid',13,'neuron',13,'layer/out_1']])
set_param([sys,'/',['Log sigmoid',13,'neuron',13,'layer/out_1']],...
		'position',[275,100,295,120])

add_block('built-in/Inport',[sys,'/',['Log sigmoid',13,'neuron',13,'layer/in_1']])
set_param([sys,'/',['Log sigmoid',13,'neuron',13,'layer/in_1']],...
		'position',[15,95,35,115])

add_block('built-in/State-Space',[sys,'/',['Log sigmoid',13,'neuron',13,'layer/Weight']])
set_param([sys,'/',['Log sigmoid',13,'neuron',13,'layer/Weight']],...
		'A','[]',...
		'B','[]',...
		'C','[]',...
		'D','K',...
		'Mask Display','W',...
		'Mask Type','Matrix Gain',...
		'Mask Dialogue','Matrix Gain.|Gain matrix:')
set_param([sys,'/',['Log sigmoid',13,'neuron',13,'layer/Weight']],...
		'Mask Translate','K = @1;',...
		'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
		'Mask Entries','W\/')
set_param([sys,'/',['Log sigmoid',13,'neuron',13,'layer/Weight']],...
		'position',[60,91,85,119])

add_block('built-in/Sum',[sys,'/',['Log sigmoid',13,'neuron',13,'layer/Sum']])
set_param([sys,'/',['Log sigmoid',13,'neuron',13,'layer/Sum']],...
		'position',[150,100,170,120])

add_block('built-in/Constant',[sys,'/',['Log sigmoid',13,'neuron',13,'layer/Bias']])
set_param([sys,'/',['Log sigmoid',13,'neuron',13,'layer/Bias']],...
		'Value','b',...
		'position',[60,155,80,175])
add_line([sys,'/',['Log sigmoid',13,'neuron',13,'layer']],[175,110;195,110])
add_line([sys,'/',['Log sigmoid',13,'neuron',13,'layer']],[255,110;270,110])
add_line([sys,'/',['Log sigmoid',13,'neuron',13,'layer']],[40,105;55,105])
add_line([sys,'/',['Log sigmoid',13,'neuron',13,'layer']],[90,105;145,105])
add_line([sys,'/',['Log sigmoid',13,'neuron',13,'layer']],[85,165;110,165;110,115;145,115])
set_param([sys,'/',['Log sigmoid',13,'neuron',13,'layer']],...
		'Mask Display','plot(0,0,100,100,[80,20],[90,70],[80,20],[50,50],[80,20],[10,30],[80,20],[50,30],[80,21],[90,30],[80,20],[10,50],[80,21],[91,50],[80,20],[50,70],[80,20],[10,70])')
set_param([sys,'/',['Log sigmoid',13,'neuron',13,'layer']],...
		'Mask Type','Neuron layer',...
		'Mask Dialogue','Log sigmoid neuron layer.\nSee logsig.m in Neural Network Toolbox.|Weight:|Bias:',...
		'Mask Translate','W=@1; b=@2;')
set_param([sys,'/',['Log sigmoid',13,'neuron',13,'layer']],...
		'Mask Help','Implements logsig(W*p,b) where W is the Weight, b is the Bias, and p is the input to the block.',...
		'Mask Entries','W\/b\/')


%     Finished composite block ['Log sigmoid',13,'neuron',13,'layer'].

set_param([sys,'/',['Log sigmoid',13,'neuron',13,'layer']],...
		'position',[65,245,95,295])


%     Subsystem  ['Tan sigmoid',13,'Neuron',13,'Layer'].

new_system([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer']])
set_param([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer']],'Location',[215,502,546,725])

add_block('built-in/Constant',[sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer/Bias']])
set_param([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer/Bias']],...
		'Value','b',...
		'position',[60,155,80,175])

add_block('built-in/Sum',[sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer/Sum']])
set_param([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer/Sum']],...
		'position',[150,100,170,120])

add_block('built-in/State-Space',[sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer/Weight']])
set_param([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer/Weight']],...
		'A','[]',...
		'B','[]',...
		'C','[]',...
		'D','K',...
		'Mask Display','W',...
		'Mask Type','Matrix Gain',...
		'Mask Dialogue','Matrix Gain.|Gain matrix:')
set_param([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer/Weight']],...
		'Mask Translate','K = @1;',...
		'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
		'Mask Entries','W\/')
set_param([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer/Weight']],...
		'position',[60,91,85,119])

add_block('built-in/Inport',[sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer/in_1']])
set_param([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer/in_1']],...
		'position',[15,95,35,115])

add_block('built-in/Outport',[sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer/out_1']])
set_param([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer/out_1']],...
		'position',[275,100,295,120])

add_block('built-in/S-Function',[sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer/tansig']])
set_param([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer/tansig']],...
		'function name','tansigc',...
		'position',[200,100,250,120])
add_line([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer']],[85,165;110,165;110,115;145,115])
add_line([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer']],[90,105;145,105])
add_line([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer']],[40,105;55,105])
add_line([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer']],[255,110;270,110])
add_line([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer']],[175,110;195,110])
set_param([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer']],...
		'Mask Display','plot(0,0,100,100,[80,20],[90,70],[80,20],[50,50],[80,20],[10,30],[80,20],[50,30],[80,21],[90,30],[80,20],[10,50],[80,21],[91,50],[80,20],[50,70],[80,20],[10,70])')
set_param([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer']],...
		'Mask Type','Neuron layer',...
		'Mask Dialogue','Tan sigmoid neuron layer.\nSee tansig.m in Neural Network Toolbox.|Weight:|Bias:',...
		'Mask Translate','W=@1; b=@2;')
set_param([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer']],...
		'Mask Help','Implements tansig(W*p,b) where W is the Weight, b is the Bias, and p is the input to the block.',...
		'Mask Entries','W\/b\/')


%     Finished composite block ['Tan sigmoid',13,'Neuron',13,'Layer'].

set_param([sys,'/',['Tan sigmoid',13,'Neuron',13,'Layer']],...
		'position',[190,250,220,300])


%     Subsystem  ['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer'].

new_system([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer']])
set_param([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer']],'Location',[215,502,546,725])

add_block('built-in/Outport',[sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer/out_1']])
set_param([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer/out_1']],...
		'position',[275,100,295,120])

add_block('built-in/Inport',[sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer/in_1']])
set_param([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer/in_1']],...
		'position',[15,95,35,115])

add_block('built-in/State-Space',[sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer/Weight']])
set_param([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer/Weight']],...
		'A','[]',...
		'B','[]',...
		'C','[]',...
		'D','K',...
		'Mask Display','W',...
		'Mask Type','Matrix Gain',...
		'Mask Dialogue','Matrix Gain.|Gain matrix:')
set_param([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer/Weight']],...
		'Mask Translate','K = @1;',...
		'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
		'Mask Entries','W\/')
set_param([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer/Weight']],...
		'position',[60,91,85,119])

add_block('built-in/Sum',[sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer/Sum']])
set_param([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer/Sum']],...
		'position',[150,100,170,120])

add_block('built-in/Constant',[sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer/Bias']])
set_param([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer/Bias']],...
		'Value','b',...
		'position',[60,155,80,175])
add_line([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer']],[175,110;270,110])
add_line([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer']],[40,105;55,105])
add_line([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer']],[90,105;145,105])
add_line([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer']],[85,165;110,165;110,115;145,115])
set_param([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer']],...
		'Mask Display','plot(0,0,100,100,[80,20],[90,70],[80,20],[50,50],[80,20],[10,30],[80,20],[50,30],[80,21],[90,30],[80,20],[10,50],[80,21],[91,50],[80,20],[50,70],[80,20],[10,70])')
set_param([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer']],...
		'Mask Type','Neuron layer',...
		'Mask Dialogue','Pure linear neuron layer.\nSee purelin.m in Neural Network Toolbox.|Weight:|Bias:')
set_param([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer']],...
		'Mask Translate','W=@1; b=@2;',...
		'Mask Help','Implements purelin(W*p,b) where W is the Weight, b is the Bias, and p is the input to the block.')
set_param([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer']],...
		'Mask Entries','W\/b\/')


%     Finished composite block ['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer'].

set_param([sys,'/',['Pure linear ',13,'(ADELINE)',13,'Neuron',13,'Layer']],...
		'position',[65,345,95,395])


%     Subsystem  ['Double click',13,'on this block',13,'for a demo.'].

new_system([sys,'/',['Double click',13,'on this block',13,'for a demo.']])
set_param([sys,'/',['Double click',13,'on this block',13,'for a demo.']],'Location',[-10,380,117,533])
set_param([sys,'/',['Double click',13,'on this block',13,'for a demo.']],...
		'Mask Display','DEMO',...
		'Mask Dialogue','eval(''nndemocs'')')


%     Finished composite block ['Double click',13,'on this block',13,'for a demo.'].

set_param([sys,'/',['Double click',13,'on this block',13,'for a demo.']],...
		'position',[109,456,164,490])


%     Subsystem  ['Radial basis',13,'Neuron',13,'Layer'].

new_system([sys,'/',['Radial basis',13,'Neuron',13,'Layer']])
set_param([sys,'/',['Radial basis',13,'Neuron',13,'Layer']],'Location',[215,502,546,725])

add_block('built-in/S-Function',[sys,'/',['Radial basis',13,'Neuron',13,'Layer/tansig']])
set_param([sys,'/',['Radial basis',13,'Neuron',13,'Layer/tansig']],...
		'function name','radbasc',...
		'position',[200,100,250,120])

add_block('built-in/Outport',[sys,'/',['Radial basis',13,'Neuron',13,'Layer/out_1']])
set_param([sys,'/',['Radial basis',13,'Neuron',13,'Layer/out_1']],...
		'position',[275,100,295,120])

add_block('built-in/Inport',[sys,'/',['Radial basis',13,'Neuron',13,'Layer/in_1']])
set_param([sys,'/',['Radial basis',13,'Neuron',13,'Layer/in_1']],...
		'position',[15,95,35,115])

add_block('built-in/State-Space',[sys,'/',['Radial basis',13,'Neuron',13,'Layer/Weight']])
set_param([sys,'/',['Radial basis',13,'Neuron',13,'Layer/Weight']],...
		'A','[]',...
		'B','[]',...
		'C','[]',...
		'D','K',...
		'Mask Display','W',...
		'Mask Type','Matrix Gain',...
		'Mask Dialogue','Matrix Gain.|Gain matrix:')
set_param([sys,'/',['Radial basis',13,'Neuron',13,'Layer/Weight']],...
		'Mask Translate','K = @1;',...
		'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
		'Mask Entries','W\/')
set_param([sys,'/',['Radial basis',13,'Neuron',13,'Layer/Weight']],...
		'position',[60,91,85,119])

add_block('built-in/Constant',[sys,'/',['Radial basis',13,'Neuron',13,'Layer/Bias']])
set_param([sys,'/',['Radial basis',13,'Neuron',13,'Layer/Bias']],...
		'Value','b',...
		'position',[60,155,80,175])

add_block('built-in/Product',[sys,'/',['Radial basis',13,'Neuron',13,'Layer/Product']])
set_param([sys,'/',['Radial basis',13,'Neuron',13,'Layer/Product']],...
		'position',[145,100,170,120])
add_line([sys,'/',['Radial basis',13,'Neuron',13,'Layer']],[175,110;195,110])
add_line([sys,'/',['Radial basis',13,'Neuron',13,'Layer']],[255,110;270,110])
add_line([sys,'/',['Radial basis',13,'Neuron',13,'Layer']],[40,105;55,105])
add_line([sys,'/',['Radial basis',13,'Neuron',13,'Layer']],[90,105;140,105])
add_line([sys,'/',['Radial basis',13,'Neuron',13,'Layer']],[85,165;110,165;110,115;140,115])
set_param([sys,'/',['Radial basis',13,'Neuron',13,'Layer']],...
		'Mask Display','plot(0,0,100,100,[80,20],[90,70],[80,20],[50,50],[80,20],[10,30],[80,20],[50,30],[80,21],[90,30],[80,20],[10,50],[80,21],[91,50],[80,20],[50,70],[80,20],[10,70])')
set_param([sys,'/',['Radial basis',13,'Neuron',13,'Layer']],...
		'Mask Type','Neuron layer',...
		'Mask Dialogue','Radial basis neuron layer.\nSee radbas.m in Neural Network Toolbox.|Weight:|Bias:',...
		'Mask Translate','W=@1; b=@2;')
set_param([sys,'/',['Radial basis',13,'Neuron',13,'Layer']],...
		'Mask Help','Implements radbas(W*p,b) where W is the Weight, b is the Bias, and p is the input to the block.',...
		'Mask Entries','W\/b\/')


%     Finished composite block ['Radial basis',13,'Neuron',13,'Layer'].

set_param([sys,'/',['Radial basis',13,'Neuron',13,'Layer']],...
		'position',[190,340,220,390])

drawnow

% Return any arguments.
if (nargin | nargout)
	% Must use feval here to access system in memory
	if (nargin > 3)
		if (flag == 0)
			eval(['[ret,x0,str,ts,xts]=',sys,'(t,x,u,flag);'])
		else
			eval(['ret =', sys,'(t,x,u,flag);'])
		end
	else
		[ret,x0,str,ts,xts] = feval(sys);
	end
else
	drawnow % Flash up the model and execute load callback
end
