Experiment 3: Aim: Generate or Functions Using Mcculloch-Pitts Neural Net by A Matlab Program
Experiment 3: Aim: Generate or Functions Using Mcculloch-Pitts Neural Net by A Matlab Program
THEORY:
The McCulloch-Pitts Model of Neuron:
The early model of an artificial neuron is introduced by Warren McCulloch and Walter Pitts in
1943. The McCulloch-Pitts neural model is also known as linear threshold gate. It is a neuron of
a set of inputs
(2.1)
(2.2)
MATLAB PROGRAM:
clear;
clc;
disp('enter weights');
w1=input('weight w1=');
w2=input('weight w2=');
disp('enter threshold value');
theta=input('theta=');
y=[0 0 0 1];
x1=[0 0 1 1];
x2=[0 1 0 1];
z=[0 1 1 1];
con=1;
while con
zin=x1*w1+x2*w2;
for i=1:4
if zin(i)>=theta
y(i)=1;
else
y1(i)=0;
end
end
disp('output of net');
disp(y);
if y==z
con=0;
else
disp('net is not learning enter another set of weights and threshold value');
w1=input('weight w1=');
w2=input('weight w2=');
theta=input('theta=');
end
end
disp('McCulloch-Pitts net for OR function ')
disp('weights of neuron');
disp(w1);
disp(w2);
disp('threshold value');
disp(theta);
RESULT:
Enter weights
Weight w1=1
Weight w2=1
Enter Threshold Value
Theta=1
Output of Net
0111
McCulloch-Pitts Net for OR function
Weights of Neuron
1
1
Threshold value
1