Flipping bits The xor operator will toggle the bit if the bit is xored with 1. E
ID: 3282004 • Letter: F
Question
Flipping bits
The xor operator will toggle the bit if the bit is xored with 1. Ex: 1 XOR 0 = 1, 1 XOR 1 = 0.
The xor operator will retain the bit if the bit is xored with 0. Ex: 0 XOR 0 = 0, 0 XOR 1 = 1.
Assigned newBits with the opposite values of oldBits if flipBits is true. Ex: If oldBits = [1, 1, 0, 1] and flipBits is 1, then newBits = [0, 0, 1, 0]
Please answer it in MATLAB format and please do not use 'if' or 'loop' function as I havn't learned it yet!
Flipping bits The xor operator will toggle the bit if the bit is xored with 1 . Ex: 1 XOR 0-1, 1 XOR 1 = 0. The xor operator will retain the bit if the bit is xored with 0, Ex: 0 XOR 0 = 0, 0 XOR 1-1 Assigned newBits with the opposite values of oldBits if flipBits is true. Ex: lf OldBits = [1, 1, 0, 1] and flipBits is 1, then newBits 10, 0, 1, 0] Your Function Save C Reset , MATLAB Documentation 1 function newBits UpdateBits(oldBits, flipBits) 21% oldBits: original ID array of bits 31% flipBits: Indicates if bits are updated (true: flip bits in oldBits, 41 % false: retain bit values in oldBits) % Assign newBits with the oppostive value of oldBits if flipBits is true newBits 8 9 end Code to call your function C Reset 1 UpdateBits([1, 1, e, 11, 1) Run FunctionExplanation / Answer
This is a Matlab code to find xor with flipbits.
here A is your oldbits.
and B is your flipbit.
you just have to fill the B matrix with the same dimension as A with same flipbit everywhere.
and the truth table will be ready.
I hope you understand the concept very well.
if you have any doubt or you want any changes in this code then you can ask me in the comment section.
thanking you.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.