Appendix E

MATLAB® Programs for Neural Control Design

Example E.1.1: Neural network for systems modelling The universal approximation capabilities of the multilayer perceptron make it a popular choice for modelling nonlinear systems. It is desired to design a two-layer feedforward neural network to model the nonlinear system described by the function y = f(x). The input/output data given below describes the input/output behaviour of the system.

Unnumbered Display Equation

A neural network model has to be developed using the input/output data.

The hidden layer with five neurons has tansigmoidal activation functions and the output layer is linear. Using batch gradient descent with momentum, train the network so that the mean square error (mse) < 0.005. The learning rate η = 0.01. Repeat training three times with different initial weights. What is the conclusion of the experiment?

 %Chapter 5 Example E.1.1 %Function approximation clear all;close all; %Training data:examplar input pattern and htarget output vector x=-1:0.1:1; y=[-0.96, -0.577, -0.073, 0.377, 0.641, 0.66, 0.461, 0.134, … -0.201, -0.434, -0.5, -0.393, -0.165, 0.099, 0.307, 0.396, … 0.345, 0.182, -0.031, -0.219, -0.32]; %Define a NN and initialise weights net=newff(minmax(x), [10 1], {'tansig', 'purelin'}, 'traingd'); %Output of NN with initial weights ycapl=sim(net, x); figure(1) plot(x, ycapl, '-', x, y, 'o'); %Train the NN figure(2) net.trainParam.epochs ...

Get Computational Intelligence: Synergies of Fuzzy Logic, Neural Networks and Evolutionary Computing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.