Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions