Write a Matlab script which takes as input a two-dimensional input range and step-size and computes the output of a neural network at every point of the grid (e.g. the input could be -1:0.1:1 and 0:0.5:10, then the script would calculate the outputs in the interval with a step-size of 0.1 in x-direction and 0.5 in y-direction). From the output of this script create 2D plots where the colour of a pixel shows the output of the network at that point. By using a threshold (e.g. for a tansig output is class 1) for the output you can visualize the decision boundary of the network. (Useful commands: meshgrid, pcolor or imagesc, colormap).

- a)
- Visualize the decision boundary in the interval
for the following networks with given weights, where
gives the input-to-hidden weights (bias in the first row) and
is the hidden-to-output weight vector.
(5)

(6)

- b)
- Train neural networks with 2, 4 and 8 hidden neurons with standard backpropagation to classify the data in data1.mat
^{5}. After training plot the training points and the corresponding decision boundaries of each network and interpret what you find. How stable are your results if you repeat the experiment?