Develop The Following Programs in The MATLAB Environment
Develop The Following Programs in The MATLAB Environment
e.g. y = 2x + 3;
x2 y2
+
=1
a2 b2
2. Write a generalized C/C++ program for Multilayer Feed Forward Neural Networks with Back
Propagation training algorithm.
3. Develop a Kohonens self organizing neural network to classify the following patterns into
required number of groups. The number of groups should be flexible and may change
according to the input data set.
X 1 = [1 2 3 4 5]
X 2 = [1.1 2.1 3.1 4.1 5.1]
X 3 = [2 3 4 5 6]
X 4 = [2.1 3.1 4.1 5.1 6.1]
X 5 = [3 4 5 6 7]
X 6 = [3.1 4.1 5.1 6.1 7.1]
4. For the problem no. 3, consider a test pattern X= [2.2 3.2 4.2 5.2 6.2]
Find the group in which the test pattern is classified and verify your results.
5. Develop a LVQ neural network to classify the following patterns into three predetermined
groups as: {X 1 ,X 2 } Group1,{ X 3 ,X 4 } Group 2 and, { X 5 ,X 6 } Group 3.
Where,
X 1 = [1 2 3 4 5]
X 2 = [1.1 2.1 3.1 4.1 5.1]
X 3 = [2 3 4 5 6]
X 4 = [2.1 3.1 4.1 5.1 6.1]
X 5 = [3 4 5 6 7]
X 6 = [3.1 4.1 5.1 6.1 7.1]
Page 1 of 7
6. For the problem no. 5, consider a test pattern X= [2.2 3.2 4.2 5.2 6.2]
Find the group in which the test pattern is classified and verify your results.
7. Consider an antilog braking system, directed by a micro controller chip. The micro controller
has to be take decision based on the temperature (T) and speed (N). The input and output
ranges are as follows:
T (0-125 C) [cold
moderate
hot]
high]
medium
high]
t=y;
q=p;
% Test Data
Page 2 of 7
However, data has to be input column wise to the ANN, and hence
transposition is necessary
q = p'
You can now verify the transposed input data (which is in a column
Page 3 of 7
%
%
%
%
%
%
%
wise format)
q =
0.1000
0.1100
0.2000
0.2200
0.3000
0.3300
0.4000
0.4400
0.5000
0.5500
1.0000
2.0000
3.0000
4.0000
5.0000
1.1000
2.1000
3.1000
4.1000
5.1000
Page 4 of 7
% Note that the network is trained to classify the input vectors into two
groups,
% First two vectors are put into class 1, and the other two vectors are put
into class 2.
Page 5 of 7
However, data has to be input colum wise to the ANN, and hence
transposition is necessary
q = P'
%
%
%
%
%
%
%
%
You can now verify the transposed input data (which is in a column
wise format)
q =
0.1000
0.1100
1.0000
1.1000
0.2000
0.2200
2.0000
2.1000
0.3000
0.3300
3.0000
3.1000
0.4000
0.4400
4.0000
4.1000
0.5000
0.5500
5.0000
5.1000
%
%
%
%
%
%
%
%
%
%
%
%
%
Page 6 of 7
T = ind2vec(Tc);
%
% This gives a sparse matrix T that can be displayed in full with
%
targets = full(T)
%
% which gives
%
targets =
%
1
1
0
0
%
0
0
1
1
%
% *******************************
%
Training
% *******************************
% Now train the network for 50 epochs. You can use either train or adapt.
%
net.trainParam.epochs = 50;
net = train(net,q,T);
% After training is complete, Simulate the network with the same input set
% to verify the accuracy of classification
a = sim(net,q);
% Output Class index of the input patterns can be checked as:
%
class_index = vec2ind(a)
% This yields
% class_index =
%
% Note that the network is trained to classify the input vectors into two predefined groups,
% First two vectors are put into class 1, and the other two vectors are put
into class 2.
%
% Now it is necessary to chechk the classification accuracy for unseen
% vector. Let us choose an unseen input vector as: q1= [1.2 2.2 3.2 4.2 5.2]
% which should belong to Class 2.
%
q1= [.12 .23 .35 .42 .55];
a = sim(net,q1');
%
% Output Class index of this unseen input patterns can be checked as:
%
class_index = vec2ind(a)
%
% This yields
% class_index = 2
Page 7 of 7