Soft Computing AND Neural Networks LAB (IT-408) : Submitted By:-Vipin Kumar 785/IT/11
Soft Computing AND Neural Networks LAB (IT-408) : Submitted By:-Vipin Kumar 785/IT/11
AND
NEURAL NETWORKS
LAB
(IT-408)
Submitted by:Vipin Kumar
785/IT/11
X2
0
0
1
1
0
1
0
1
0
1
1
0
if y==z
con=0;
else
disp('Net is not learning enter another set of weights and Threshold value');
w11=input('Weight w11=');
w12=input('weight w12=');
w21=input('Weight w21=');
w22=input('weight w22=');
v1=input('weight v1=');
v2=input('weight v2=');
theta=input('theta=');
end
end
disp('McCulloch-Pitts Net for XOR function');
disp('Weights of Neuron Z1');
disp(w11);
disp(w21);
disp('weights of Neuron Z2');
disp(w12);
disp(w22);
disp('weights of Neuron Y');
disp(v1);
disp(v2);
disp('Threshold value');
disp(theta);
Output
Enter weights
Weight w11=1
weight w12=-1
Weight w21=-1
weight w22=1
weight v1=1
weight v2=1
Enter Threshold Value
theta=1
Output of Net
0
1
1
0
McCulloch-Pitts Net for XOR function
Weights of Neuron Z1
1
-1
weights of Neuron Z2
-1
1
weights of Neuron Y
1
1
Threshold value
2. Write a MATLAB program for perceptron net for an AND NOT function with bipolar inputs and targets.
Solution The truth table for the AND NOT function is given as
X1
X2
-1
1
1
Final Bias
-1
end
end
AND gate
clear;
clc;
x=[ 1,1,-1,-1; 1,-1,1,-1];
y=[1,-1,-1,-1];
w=[0 0];
b=0;
for i=1:4
for j=1:2
w(j)=w(j)+x(j,i)*y(i);
end
b=b+y(i);
end
disp('Hebb for AND funtion');
disp(' Final Weight matrix');
disp(w);
disp('Final Bias');
disp(b);
end
Output: Weight matrix
1
1 1 1
1
1 1 1
1 1
1
1
1 1
1
1
The vector is a known vector.
2 2
2
INDEX
1. Generate XOR function using McCulloch-Pitts neuron by writing
an M-file.
2. Write a MATLAB program for perceptron net for an AND NOT
function with bipolar inputs and targets.
3. Write a MATLAB Program for OR Gate Using Adalaine Neural
Network.
4. Write a MATLAB PROGRAM for AND Gate using Hebb
Network.
5. Write any MATLAB Program using Auto associative net.
6. Write any MATLAB Program using Hetro associative net.
7. Write any MATLAB Program using BAM net.
SOFT COMPUTING
AND
NEURAL NETWORKS
LAB
(IT-408)
Submitted by:-
Shivang Yadav
775/IT/11