# XOR - Logical EXCLUSIVE OR

A B x o r (A,B)
0 0 0
0 1 1
1 0 1
1 1 0

For the logical exclusive OR, XOR(A,B), the result is logical 1 (TRUE) where either A or B, but not both, is nonzero. The result is logical 0 (FALSE) where A and B are both zero or nonzero.

A and B must have the same dimensions (or one can be a scalar).

This is the common symbol for the 'Exclusive OR'

Example:
If matrix A is:
A =

0 0 1 1
1 1 0 0
0 0 0 0
1 1 1 1

and matrix B is:
B =

0 0 0 0
1 1 1 1
0 1 0 1
1 0 1 0

Then, the logical EXCLUSIVE OR between A and B is:

>> xor(A,B)

ans =

0 0 1 1
0 0 1 1
0 1 0 1
0 1 0 1

>>

Example:
If vector x is:
x =

0 1 2 3 0

and vector y is:
y =

1 2 3 0 0

Then, the logical exclusive OR between x and y is:

ans =

1 0 0 1 0

From 'Exclusive OR' to home

From 'XOR' to 'Boolean Algebra Menu'

 Top Logical AND Logical OR De Morgan's Laws

## Related pages

binomial expansion pyramid5 band resistance calculatorexclusive or xorwhat is gca in matlabinterpolation using matlabhow to calculate fibonacci numbers3d surface matlabmatlab minimize functionmatlab graphical user interface tutorialmaclaurin series cosh xscilab helpgray code to binary converterstair plot matlabhow to draw piecewise functionshow to plot a circle in matlablagrange polynomial interpolation matlabbinomial distribution calcsolids of revolution examplescramers rule examplesseries de maclaurinhalf life formula calculusascii characters chartsawtooth wave fourier seriescombinational logic circuits tutorialhow to calculate permutations and combinationsfibonaci series programannual simple interest rate calculatorexponential regression functionmatlab fillwrite a matlab programmatlab interp1how to solve rc circuitssimple rc circuitexponential fitting in matlabexample of palindrome stringmatlab fliplrboolean lawsolve equation matlabgraphing functions in matlabpolynomial fit matlabrc time constant derivationpolyval matlabpiecewise definitionamortization tables for mortgagesfibonacci golden ratio calculatorohm law chartfourier series in matlab codecompound interest formula continuously examplesmatlab solve algebraic equationinverting a matrix in matlabxlabel matlabdefine time constant of rc circuitconversion binary to octalquad in matlabhow to calculate salvage value of equipmentdatafithow to plot a histogram in matlabpolynomial root finder calculatorsolve piecewise functionsdiscrete distribution calculatorsolve quadratic equation in matlabzero finder calculatorcreate histogram matlabmatlab fit functionsolving fibonacci sequence3d rectanglesquad function matlabcompounding continuously interest calculatormatlab gradient functionrecursivitymatlab solve system of equationsprintable ascii chartoctave ode45 exampledecimal to gray code conversionhow to solve a nonlinear equation in matlab