How to perform xor operation on an three input binary bits.

조회 수: 62 (최근 30일)
Iftekharuddin Syed
Iftekharuddin Syed 2020년 11월 16일
댓글: Jon 2020년 11월 16일
How to perform xor operation on an three input binary bits.
for two inputs we use xor(1,0),
for three input bits xor(1,1,0), gives error.
How to perform the calculation?

채택된 답변

Setsuna Yuuki.
Setsuna Yuuki. 2020년 11월 16일
편집: Setsuna Yuuki. 2020년 11월 16일
a = xor(1,1); %1 xor 1 = 1
b = xor(a,0) %1 xor 0 = 0
%or
c = xor(xor(1,1),0)

추가 답변 (1개)

Jon
Jon 2020년 11월 16일
The MATLAB function xor takes two input arguments and and provides and xor between the elements of each argument.
So for example
x = [true;false;true]
y = [false;false;true]
z = xor(x,y)
z =
3×1 logical array
1
0
0
  댓글 수: 2
Iftekharuddin Syed
Iftekharuddin Syed 2020년 11월 16일
There are three separate inputs in my case, these are feedback signals which needs xor operation
Jon
Jon 2020년 11월 16일
Note xor is a binary operation which takes two inputs bits and provides one output bit. The output bit is set to true (1) if exactly one of the input bits is 1 otherwise it is set to zero. I don't understand what you mean by taking the xor of three inputs. Please explain further exactly what operation you are trying to perform. So for example if you have for your three inputs u1 = 1 (true) u2 = 1 (true) u3 = 0 (false) then how do you define your output "xor".

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by