Question: THIS IS A MATLAB PROBLEM As discussed in class, computer architectures rely on binary numbers (base 2) to do simple arithmetic operations. Since we ar

THIS IS A MATLAB PROBLEM As discussed in class, computer architectures relyon binary numbers (base 2) to do simple arithmetic operations. Since wear more familiar with the decimal system (base 10), virtually all programmingTHIS IS A MATLAB PROBLEM

As discussed in class, computer architectures rely on binary numbers (base 2) to do simple arithmetic operations. Since we ar more familiar with the decimal system (base 10), virtually all programming languages offer support for interconverting betwee binary and decimal representations of the same number. In MATLAB, these functions are bi2de and de2bi. A binary vector B is a logical vector (containing 0s or ls only) that encodes a decimal number D using the binary scheme outlined in Figure 1, with the last element being the most significant bit n-1 x 20 x 21 x 2 x 2n U Sum D 32 obi 21b2 22b3 2'n 1bn Figure 1. Write a MATLAB function, C- binaryop(B1, B2, op), that performs a simple arithmetic operation on binary vectors B1 and B2. The text string op can be either as "add' or 'multiply. In the case that op is'add, output the binary vector Cas the sum of the numbers encoded in the binary vectors Bl and B2. If op is 'multiply, then perform a multiplication operation on the numbers encoded in the binary vectors B1 and B2, and output this value in binary as the vector C

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!