Professional Documents
Culture Documents
Matlab offers a range of toolboxes to implement and train neural networks for
various problem types.
Note: in the newer versions of Matlab there are some changes in the command
names and the syntax, for that you can check the help platform embedded in the
Matlab to look up the equivalent commands to apply the same functions.
The MATLAB commands used in the procedure are newff, train and sim.
The MATLAB command newff generates a MLPN neural network, which is
called net.
To test how well the resulting MLP net1 approximates the data, sim command
is applied
Example: Consider Bessel functions Jα(t), which are solutions of the differential
equation
a) Plot J1(t).
b) Try different structures to for fitting. Start with a two-layer network.
You might also need different learning algorithms.
SOLUTION:
1- First generate the data.
MATLAB has Bessel functions as MATLAB functions.
t=0:0.1:20; y=bessel(1,t);
plot(t,y)
grid
xlabel('time in secs');ylabel(‘y’); title('First order bessel function');
%Define parameters
net.trainParam.show = 50;
net.trainParam.lr = 0.05;
net.trainParam.epochs = 300;
net.trainParam.goal = 1e-3;
%Train network
net1 = train(net, P, T);