MATLAB: How to generate code for a trained RBF (Radial Basis Function) neural network in MATLAB

neural network

I have successfully trained an RBF network using two layers and I can readily get the weights and biases for both layers. Using these weighs and bias values I want to reproduce the network to track the values of the inputs at various stages. Unlike In MLP, I can't seem to find any means to generate the code for the trained network. So far what I have done are as follows.
note: Before training the RBF with newrb I normalized the inputs and outputs between 0.1 to 0.9 under normalizations ids [pn,ps] and [tn,ts] respectively.
iw=cell2mat(net.iw(1));         %input weight lw=cell2mat(net.lw(2,1));       %layerweight
ib=cell2mat(net.b(1));           %input bias lb=cell2mat(net.b(2));           %layer bias
a= radbas(netprod(dist(iw,pn),ib));       %radial basis transfer function applied to the distance between iw and pn.
a2=dotprod(net.lw{2,1},a);                    %product of first layer output with layer weights
a2=gadd(a2,net.b{2});                         %add with layer bias
a2=mapminmax('reverse',a2,ts);         %reverse the normalization as followed in the newrb which was from 0.1 to 0.9
However I am not getting the a2 outputs equal to the ones I got from net(pn).
Please help me.

Best Answer

1. To obtain source code use the command TYPE:
type newrb
However, If you have older versions of MATLAB, the code is MUCH, MUCH easier to understand.
2. I don't remember if I have posted anything on the actual code itself. However, you can search
ANSWERS NEWSGROUP
greg radbas 16 23
greg newrb 56 148
Hope this helps.
Thank you for formerly accepting my answer
Greg