Question: PROGRAMMING IN MATLAB Write a function with header [b] = myBinAdder(b1,b2), where b1, b2, and b are binary numbers. The output variable should be computed
PROGRAMMING IN MATLAB
Write a function with header [b] = myBinAdder(b1,b2), where b1, b2, and b are binary numbers. The output variable should be computed as b = b1+b2. This function should be able to accept inputs b1 and b2 of any length (i.e., very long binary numbers), and b1 and b2 may not necessarily be the same length.
Test cases:
>> b = myBinAdder([1 1 1 1 1], [1])
b = 1 0 0 0 0 0
>> b = myBinAdder([1 1 1 1 1], [1 0 1 0 1 0 0])
b = 1 1 1 0 0 1 1
>> b = myBinAdder([1 1 0], [1 0 1])
b = 1 0 1 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
