one's and two's complement
38 次查看(过去 30 天)
显示 更早的评论
how to convert 8 bit binary numbers into one's and two's complement
Let a=11001011
ones_complement=00110100
twos_complement=00110101
0 个评论
采纳的回答
Azzi Abdelmalek
2014-3-1
编辑:Azzi Abdelmalek
2014-3-1
a='11001011';
c1=not(a-'0') % one's complement
d=1;
for k=numel(a):-1:1
r=d & c1(k);
c2(1,k)=xor(d,c1(k)); % c2 is two's complement
d=r;
end
[c1;c2]
3 个评论
Naga viswanathreddy Siddam
2021-3-11
编辑:Naga viswanathreddy Siddam
2021-3-14
How can I get reverse of the Two's complement,from a mpu 9250 sensor output!!
更多回答(1 个)
MD SAMIM AKTAR
2020-4-20
a='11001011';
c1=not(a-'0') % one's complement
d=1;
for k=numel(a):-1:1
r=d & c1(k);
c2(1,k)=xor(d,c1(k)); % c2 is two's complement
d=r;
end
[c1;c2]
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!