Test 2 Lab Simulation: Perception Using OR Gate Back Propagation AND Gate
Test 2 Lab Simulation: Perception Using OR Gate Back Propagation AND Gate
:DONE BY
BH: 17500440
SECTION: MQ
:SUBMITTED TO
DR. satheees
:Introduction
The aim of this lap report to Design the perceptron neural network model for OR gate
And to Design the back propagation model for AND gate using binary sigmoidal activation
function
Objective:
:At the completion of this lab, the student will be able to
Apply the formulas and to determine the output using Perceptron neural .1
network and Back
.propagation algorithm
Run a neural network simulation using Mat lab and determine the outputs .2
using various
.inputs parameters
Perception
end;
% wb =wb+a . *x(i,n);
wb= wb + x(i,n);
end
% disp (‘============’)
m=
n=
w=
2 2
wb =
-2
Enter inputs
Input x1=-1
Input x2=-1
R=
logical
m=
n=
w=
2 2
wb =
Enter inputs
Input x1=-1
Input x2=1
R=
logical
m=
4
n=
w=
2 2
wb =
Enter inputs
Input x1=-1
Input x2=1
R=
logical
m=
n=
w=
2 2
wb =
-2
Enter inputs
Input x1=-1
Input x2=1
R=
logical
m=
n=
3
w=
2 2
wb =
-2
Enter inputs
Input x1=1
Input x2=1
R=
logical
m=
n=
w=
2 2
wb =
Enter inputs
Input x1=1
Input x2=-1
R=
logical
1
Back propagation
close all;
clear all;
clc;
p = [ 0 1 0 1 ; 0 0 1 1 ] ; % Input pattern
t = [ 1 0 0 0 ] ; % Target
net.trainParam.goal=0.0001*var(t',1);
net.layers{ 1 }.transferFcn='logsig'
net.layers{ 2 }.transferFcn='tansig'
net.divideFcn='dividetrain';
net.trainParam.show=1;
% net.trainParam.min_grad = 1e - 20 ;
% net.trainParam.mu_max = 1e20 ;
net.trainParam.lr=0.15 ;
net.trainParam.mc=0.9 ;
a= net( p )
p1 = [ 0 1 0 1 ; 0 0 1 1 ] ;
[m n] = size(p1);
y= sim(net,p1);
y=round(y)
Conclusion:
Using the procedural steps, the training and testing algorithm have been created
to test OR gates.
Using back propagation AND gate to test the requirement of the lap report
These have proven to be right using the procedure.
References:
https://towardsdatascience.com/implementing-the-xor-gate-using-
backpropagation-in-neural-networks-c1f255b4f20d
https://www.mathworks.com/matlabcentral/fileexchange/65211-exclusive-or-
code-using-back-propagation-neural-network