SlideShare ist ein Scribd-Unternehmen logo
1 von 6
Downloaden Sie, um offline zu lesen
% % Generate XOR function using McCulloch-Pitts neuron by writing an M-file.
%XOR function using McCulloch-Pitts neuron
clear all
close all;
clc;
%Getting weights and threshold value
disp('Enter weights');
w1=input('Weight w1=');
w2=input('weight w2=');
w3=input('Weight w3=');
w4=input('weight w4=');
v1=input('weight v1=');
v2=input('weight v2=');
b1=input('bias 1=');
b2=input('bias 2=');
b3=input('bias 3=');
disp('Enter Threshold Value');
theta=input('theta=');
x1=[0 0 1 1];
x2=[0 1 0 1];
z=[1 0 0 1];
con=1;
while con
zin1=x1*w1+x2*w3+1*b1;
zin2=x1*w2+x2*w4+1*b2;
for i=1:4
if zin1(i)>=theta
y1(i)=1;
else
y1(i)=0;
end
if zin2(i)>=theta
y2(i)=1;
else
y2(i)=0;
end
end
yin=y1*v1+y2*v2+1*b3;
for i=1:4
if yin(i)>=theta;
y(i)=1;
else
y(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=');
w3=input('Weight w3=');
w4=input('weight w4=');
v1=input('weight v1=');
v2=input('weight v2=');
theta=input('theta=');
b1=input('bias 1=');
b2=input('bias 2=');
b3=input('bias 3=');
end
end
disp('McCulloch-Pitts Net for XNOR function');
disp('Weights of Neuron Z1');
disp(w1);
disp(w3);
disp('weights of Neuron Z2');
disp(w2);
disp(w4);
disp('weights of Neuron Y');
disp(v1);
disp(v2);
disp('Threshold value');
disp(theta);
% Enter weights
% Weight w1=1
% weight w2=-1
% Weight w3=1
% weight w4=-1
% weight v1=2
% weight v2=2
% Enter Threshold Value
% theta=1
% b1=-1
% b2=1
% b3=-1
% % Generate XOR function using McCulloch-Pitts neuron by writing an M-file.
%XOR function using McCulloch-Pitts neuron
clear all
close all;
clc;
%Getting weights and threshold value
disp('Enter weights');
w1=input('Weight w1=');
w2=input('weight w2=');
w3=input('Weight w3=');
w4=input('weight w4=');
v1=input('weight v1=');
v2=input('weight v2=');
b1=input('bias 1=');
b2=input('bias 2=');
b3=input('bias 3=');
disp('Enter Threshold Value');
theta=input('theta=');
x1=[0 0 1 1];
x2=[0 1 0 1];
z=[1 0 0 1];
con=1;
while con
zin1=x1*w1+x2*w3+1*b1;
zin2=x1*w2+x2*w4+1*b2;
for i=1:4
if zin1(i)>=theta
y1(i)=1;
else
y1(i)=0;
end
if zin2(i)>=theta
y2(i)=1;
else
y2(i)=0;
end
end
yin=y1*v1+y2*v2+1*b3;
for i=1:4
if yin(i)>=theta;
y(i)=1;
else
y(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=');
w3=input('Weight w3=');
w4=input('weight w4=');
v1=input('weight v1=');
v2=input('weight v2=');
theta=input('theta=');
b1=input('bias 1=');
b2=input('bias 2=');
b3=input('bias 3=');
end
end
disp('McCulloch-Pitts Net for XNOR function');
disp('Weights of Neuron Z1');
disp(w1);
disp(w3);
disp('weights of Neuron Z2');
disp(w2);
disp(w4);
disp('weights of Neuron Y');
disp(v1);
disp(v2);
disp('Threshold value');
disp(theta);
% Enter weights
% Weight w1=1
% weight w2=-1
% Weight w3=1
% weight w4=-1
% weight v1=2
% weight v2=2
% Enter Threshold Value
% theta=1
% b1=-1
% b2=1
% b3=-1
Laboratory Experiment No. Title Introduction Objectives Materials Procedure Results
Discussion Conclusion References

Weitere ähnliche Inhalte

Mehr von mdualudin007

(1 Point) Please match the following variable properties with their d.pdf
 (1 Point) Please match the following variable properties with their d.pdf (1 Point) Please match the following variable properties with their d.pdf
(1 Point) Please match the following variable properties with their d.pdfmdualudin007
 
(1 point) If samples of size 37 are taken from a population with mean.pdf
 (1 point) If samples of size 37 are taken from a population with mean.pdf (1 point) If samples of size 37 are taken from a population with mean.pdf
(1 point) If samples of size 37 are taken from a population with mean.pdfmdualudin007
 
Bag breaks open; included as delay in the allowance factor Conveyo.pdf
  Bag breaks open; included as delay in the allowance factor  Conveyo.pdf  Bag breaks open; included as delay in the allowance factor  Conveyo.pdf
Bag breaks open; included as delay in the allowance factor Conveyo.pdfmdualudin007
 
Prove the following E(MSR)=2+12(Xix)2.pdf
  Prove the following E(MSR)=2+12(Xix)2.pdf  Prove the following E(MSR)=2+12(Xix)2.pdf
Prove the following E(MSR)=2+12(Xix)2.pdfmdualudin007
 
Computer Architecture HOW do I design a computer = Instruction .pdf
  Computer Architecture HOW do I design a computer  = Instruction .pdf  Computer Architecture HOW do I design a computer  = Instruction .pdf
Computer Architecture HOW do I design a computer = Instruction .pdfmdualudin007
 
( Ch2 ISA)3. Assume that the top of the stack in a progra.pdf
 ( Ch2 ISA)3. Assume that the top of the stack in a progra.pdf ( Ch2 ISA)3. Assume that the top of the stack in a progra.pdf
( Ch2 ISA)3. Assume that the top of the stack in a progra.pdfmdualudin007
 
The goal of this assignment is to get familiar with pipelining in C.pdf
  The goal of this assignment is to get familiar with pipelining in C.pdf  The goal of this assignment is to get familiar with pipelining in C.pdf
The goal of this assignment is to get familiar with pipelining in C.pdfmdualudin007
 
( 20 points) Benzene is a common groundwater contaminant. Based on a .pdf
 ( 20 points) Benzene is a common groundwater contaminant. Based on a .pdf ( 20 points) Benzene is a common groundwater contaminant. Based on a .pdf
( 20 points) Benzene is a common groundwater contaminant. Based on a .pdfmdualudin007
 
(2) Solve the following recurrence relation by using Recursion Trees .pdf
 (2) Solve the following recurrence relation by using Recursion Trees .pdf (2) Solve the following recurrence relation by using Recursion Trees .pdf
(2) Solve the following recurrence relation by using Recursion Trees .pdfmdualudin007
 
(20 pts) Let X and Y be two statistically independent random variable.pdf
 (20 pts) Let X and Y be two statistically independent random variable.pdf (20 pts) Let X and Y be two statistically independent random variable.pdf
(20 pts) Let X and Y be two statistically independent random variable.pdfmdualudin007
 
(2 pts.) Consider the following ordered list of data, x and a key.pdf
 (2 pts.) Consider the following ordered list of data,  x  and a key.pdf (2 pts.) Consider the following ordered list of data,  x  and a key.pdf
(2 pts.) Consider the following ordered list of data, x and a key.pdfmdualudin007
 
(2 points) (Problem 4.96) Suppose that a random variable Y has a prob.pdf
 (2 points) (Problem 4.96) Suppose that a random variable Y has a prob.pdf (2 points) (Problem 4.96) Suppose that a random variable Y has a prob.pdf
(2 points) (Problem 4.96) Suppose that a random variable Y has a prob.pdfmdualudin007
 
(1pts) Refer to figure above. At Q1, there is a tendency for Real GDP.pdf
 (1pts) Refer to figure above. At Q1, there is a tendency for Real GDP.pdf (1pts) Refer to figure above. At Q1, there is a tendency for Real GDP.pdf
(1pts) Refer to figure above. At Q1, there is a tendency for Real GDP.pdfmdualudin007
 
(15 pts) The joint density function of random variables X and Y is gi.pdf
 (15 pts) The joint density function of random variables X and Y is gi.pdf (15 pts) The joint density function of random variables X and Y is gi.pdf
(15 pts) The joint density function of random variables X and Y is gi.pdfmdualudin007
 
(12 points) X and Y are identically distributed random variables with.pdf
 (12 points) X and Y are identically distributed random variables with.pdf (12 points) X and Y are identically distributed random variables with.pdf
(12 points) X and Y are identically distributed random variables with.pdfmdualudin007
 
(10 points) A Bernoull difterential equation is one of the form dxdy+.pdf
 (10 points) A Bernoull difterential equation is one of the form dxdy+.pdf (10 points) A Bernoull difterential equation is one of the form dxdy+.pdf
(10 points) A Bernoull difterential equation is one of the form dxdy+.pdfmdualudin007
 
�rg�tsel davranzlenim Y�netimi, Giriim Sermayesi Tarz Giriim kap.pdf
�rg�tsel davranzlenim Y�netimi, Giriim Sermayesi Tarz Giriim kap.pdf�rg�tsel davranzlenim Y�netimi, Giriim Sermayesi Tarz Giriim kap.pdf
�rg�tsel davranzlenim Y�netimi, Giriim Sermayesi Tarz Giriim kap.pdfmdualudin007
 
�Qu� tipo de profesional de recursos humanos utiliza varios m�todos,.pdf
�Qu� tipo de profesional de recursos humanos utiliza varios m�todos,.pdf�Qu� tipo de profesional de recursos humanos utiliza varios m�todos,.pdf
�Qu� tipo de profesional de recursos humanos utiliza varios m�todos,.pdfmdualudin007
 
�� aylk yatrm i�in fazladan 1.000.000 ABD dolar olan IBMin sayman o.pdf
�� aylk yatrm i�in fazladan 1.000.000 ABD dolar olan IBMin sayman o.pdf�� aylk yatrm i�in fazladan 1.000.000 ABD dolar olan IBMin sayman o.pdf
�� aylk yatrm i�in fazladan 1.000.000 ABD dolar olan IBMin sayman o.pdfmdualudin007
 

Mehr von mdualudin007 (19)

(1 Point) Please match the following variable properties with their d.pdf
 (1 Point) Please match the following variable properties with their d.pdf (1 Point) Please match the following variable properties with their d.pdf
(1 Point) Please match the following variable properties with their d.pdf
 
(1 point) If samples of size 37 are taken from a population with mean.pdf
 (1 point) If samples of size 37 are taken from a population with mean.pdf (1 point) If samples of size 37 are taken from a population with mean.pdf
(1 point) If samples of size 37 are taken from a population with mean.pdf
 
Bag breaks open; included as delay in the allowance factor Conveyo.pdf
  Bag breaks open; included as delay in the allowance factor  Conveyo.pdf  Bag breaks open; included as delay in the allowance factor  Conveyo.pdf
Bag breaks open; included as delay in the allowance factor Conveyo.pdf
 
Prove the following E(MSR)=2+12(Xix)2.pdf
  Prove the following E(MSR)=2+12(Xix)2.pdf  Prove the following E(MSR)=2+12(Xix)2.pdf
Prove the following E(MSR)=2+12(Xix)2.pdf
 
Computer Architecture HOW do I design a computer = Instruction .pdf
  Computer Architecture HOW do I design a computer  = Instruction .pdf  Computer Architecture HOW do I design a computer  = Instruction .pdf
Computer Architecture HOW do I design a computer = Instruction .pdf
 
( Ch2 ISA)3. Assume that the top of the stack in a progra.pdf
 ( Ch2 ISA)3. Assume that the top of the stack in a progra.pdf ( Ch2 ISA)3. Assume that the top of the stack in a progra.pdf
( Ch2 ISA)3. Assume that the top of the stack in a progra.pdf
 
The goal of this assignment is to get familiar with pipelining in C.pdf
  The goal of this assignment is to get familiar with pipelining in C.pdf  The goal of this assignment is to get familiar with pipelining in C.pdf
The goal of this assignment is to get familiar with pipelining in C.pdf
 
( 20 points) Benzene is a common groundwater contaminant. Based on a .pdf
 ( 20 points) Benzene is a common groundwater contaminant. Based on a .pdf ( 20 points) Benzene is a common groundwater contaminant. Based on a .pdf
( 20 points) Benzene is a common groundwater contaminant. Based on a .pdf
 
(2) Solve the following recurrence relation by using Recursion Trees .pdf
 (2) Solve the following recurrence relation by using Recursion Trees .pdf (2) Solve the following recurrence relation by using Recursion Trees .pdf
(2) Solve the following recurrence relation by using Recursion Trees .pdf
 
(20 pts) Let X and Y be two statistically independent random variable.pdf
 (20 pts) Let X and Y be two statistically independent random variable.pdf (20 pts) Let X and Y be two statistically independent random variable.pdf
(20 pts) Let X and Y be two statistically independent random variable.pdf
 
(2 pts.) Consider the following ordered list of data, x and a key.pdf
 (2 pts.) Consider the following ordered list of data,  x  and a key.pdf (2 pts.) Consider the following ordered list of data,  x  and a key.pdf
(2 pts.) Consider the following ordered list of data, x and a key.pdf
 
(2 points) (Problem 4.96) Suppose that a random variable Y has a prob.pdf
 (2 points) (Problem 4.96) Suppose that a random variable Y has a prob.pdf (2 points) (Problem 4.96) Suppose that a random variable Y has a prob.pdf
(2 points) (Problem 4.96) Suppose that a random variable Y has a prob.pdf
 
(1pts) Refer to figure above. At Q1, there is a tendency for Real GDP.pdf
 (1pts) Refer to figure above. At Q1, there is a tendency for Real GDP.pdf (1pts) Refer to figure above. At Q1, there is a tendency for Real GDP.pdf
(1pts) Refer to figure above. At Q1, there is a tendency for Real GDP.pdf
 
(15 pts) The joint density function of random variables X and Y is gi.pdf
 (15 pts) The joint density function of random variables X and Y is gi.pdf (15 pts) The joint density function of random variables X and Y is gi.pdf
(15 pts) The joint density function of random variables X and Y is gi.pdf
 
(12 points) X and Y are identically distributed random variables with.pdf
 (12 points) X and Y are identically distributed random variables with.pdf (12 points) X and Y are identically distributed random variables with.pdf
(12 points) X and Y are identically distributed random variables with.pdf
 
(10 points) A Bernoull difterential equation is one of the form dxdy+.pdf
 (10 points) A Bernoull difterential equation is one of the form dxdy+.pdf (10 points) A Bernoull difterential equation is one of the form dxdy+.pdf
(10 points) A Bernoull difterential equation is one of the form dxdy+.pdf
 
�rg�tsel davranzlenim Y�netimi, Giriim Sermayesi Tarz Giriim kap.pdf
�rg�tsel davranzlenim Y�netimi, Giriim Sermayesi Tarz Giriim kap.pdf�rg�tsel davranzlenim Y�netimi, Giriim Sermayesi Tarz Giriim kap.pdf
�rg�tsel davranzlenim Y�netimi, Giriim Sermayesi Tarz Giriim kap.pdf
 
�Qu� tipo de profesional de recursos humanos utiliza varios m�todos,.pdf
�Qu� tipo de profesional de recursos humanos utiliza varios m�todos,.pdf�Qu� tipo de profesional de recursos humanos utiliza varios m�todos,.pdf
�Qu� tipo de profesional de recursos humanos utiliza varios m�todos,.pdf
 
�� aylk yatrm i�in fazladan 1.000.000 ABD dolar olan IBMin sayman o.pdf
�� aylk yatrm i�in fazladan 1.000.000 ABD dolar olan IBMin sayman o.pdf�� aylk yatrm i�in fazladan 1.000.000 ABD dolar olan IBMin sayman o.pdf
�� aylk yatrm i�in fazladan 1.000.000 ABD dolar olan IBMin sayman o.pdf
 

Kürzlich hochgeladen

Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 

Kürzlich hochgeladen (20)

Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 

Generate XOR function using McCulloch-Pitts neuron by writing .pdf

  • 1. % % Generate XOR function using McCulloch-Pitts neuron by writing an M-file. %XOR function using McCulloch-Pitts neuron clear all close all; clc; %Getting weights and threshold value disp('Enter weights'); w1=input('Weight w1='); w2=input('weight w2='); w3=input('Weight w3='); w4=input('weight w4='); v1=input('weight v1='); v2=input('weight v2='); b1=input('bias 1='); b2=input('bias 2='); b3=input('bias 3='); disp('Enter Threshold Value'); theta=input('theta='); x1=[0 0 1 1]; x2=[0 1 0 1]; z=[1 0 0 1]; con=1; while con zin1=x1*w1+x2*w3+1*b1; zin2=x1*w2+x2*w4+1*b2; for i=1:4 if zin1(i)>=theta y1(i)=1; else y1(i)=0; end if zin2(i)>=theta y2(i)=1; else
  • 2. y2(i)=0; end end yin=y1*v1+y2*v2+1*b3; for i=1:4 if yin(i)>=theta; y(i)=1; else y(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='); w3=input('Weight w3='); w4=input('weight w4='); v1=input('weight v1='); v2=input('weight v2='); theta=input('theta='); b1=input('bias 1='); b2=input('bias 2='); b3=input('bias 3='); end end disp('McCulloch-Pitts Net for XNOR function'); disp('Weights of Neuron Z1'); disp(w1); disp(w3); disp('weights of Neuron Z2'); disp(w2); disp(w4);
  • 3. disp('weights of Neuron Y'); disp(v1); disp(v2); disp('Threshold value'); disp(theta); % Enter weights % Weight w1=1 % weight w2=-1 % Weight w3=1 % weight w4=-1 % weight v1=2 % weight v2=2 % Enter Threshold Value % theta=1 % b1=-1 % b2=1 % b3=-1 % % Generate XOR function using McCulloch-Pitts neuron by writing an M-file. %XOR function using McCulloch-Pitts neuron clear all close all; clc; %Getting weights and threshold value disp('Enter weights'); w1=input('Weight w1='); w2=input('weight w2='); w3=input('Weight w3='); w4=input('weight w4=');
  • 4. v1=input('weight v1='); v2=input('weight v2='); b1=input('bias 1='); b2=input('bias 2='); b3=input('bias 3='); disp('Enter Threshold Value'); theta=input('theta='); x1=[0 0 1 1]; x2=[0 1 0 1]; z=[1 0 0 1]; con=1; while con zin1=x1*w1+x2*w3+1*b1; zin2=x1*w2+x2*w4+1*b2; for i=1:4 if zin1(i)>=theta y1(i)=1; else y1(i)=0; end if zin2(i)>=theta y2(i)=1; else y2(i)=0; end end yin=y1*v1+y2*v2+1*b3; for i=1:4 if yin(i)>=theta; y(i)=1; else y(i)=0; end end disp('Output of Net'); disp(y);
  • 5. 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='); w3=input('Weight w3='); w4=input('weight w4='); v1=input('weight v1='); v2=input('weight v2='); theta=input('theta='); b1=input('bias 1='); b2=input('bias 2='); b3=input('bias 3='); end end disp('McCulloch-Pitts Net for XNOR function'); disp('Weights of Neuron Z1'); disp(w1); disp(w3); disp('weights of Neuron Z2'); disp(w2); disp(w4); disp('weights of Neuron Y'); disp(v1); disp(v2); disp('Threshold value'); disp(theta); % Enter weights % Weight w1=1 % weight w2=-1 % Weight w3=1
  • 6. % weight w4=-1 % weight v1=2 % weight v2=2 % Enter Threshold Value % theta=1 % b1=-1 % b2=1 % b3=-1 Laboratory Experiment No. Title Introduction Objectives Materials Procedure Results Discussion Conclusion References