If A= [1001] and B=[0101], what will be the value of the multiplication of A and B in MATLAB? I am new here. So, having trouble understanding
2 次查看(过去 30 天)
显示 更早的评论
If A= [1001] and B=[0101], what will be the value of the multiplication of A and B in MATLAB? I am new here. So, having trouble understanding
回答(1 个)
Udit06
2024-2-12
Hi Hasin,
The multiplication of two binary numbers A =
and B =
follows the shift and add method, similar to long multiplication of decimal numbers. Let's multiply them as you would on paper:


1 0 0 1 (A)
× 0 1 0 1 (B)
------------
1 0 0 1 (A * 1)
0 0 0 0 (A * 0, shifted one position to the left)
1 0 0 1 (A * 1, shifted two positions to the left)
+0 0 0 0 (A * 0, shifted three positions to the left)
------------
1 0 1 1 0 1 (Result)
------------
Hence, the resultant of multiplication of A and B comes out to be
which is equivant to 45 in decimal number system.

You can refer to bin2dec and dec2bin functions for interconversion between the two number systems.
I hope it helps.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!