Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

matlab help 1) Computation of additions of binary numbers In this homework, our objective is to write a script that adds two binary numbers and

matlab help
image text in transcribed
image text in transcribed
1) Computation of additions of binary numbers In this homework, our objective is to write a script that adds two binary numbers and returns the output. We do not want to use the built in addition of Matlab, but instead use the tables of addition for binary number. For the purpose of this homework, we assume that we want to add two 8 bit integer numbers together, and return the result on 10 bits. For example, if the numbers a and b are a==01001 ' and b=11, the sum a+b=01100 (in this example, a=9.b=3 and a+b=12 ) Hints: - Use the same rules to add in binary as you would do in decimal (starting from the right, carrying over the 1, etc.). Look at this page for a few examples on how to do the addition: https://web.math.princeton.edu/math alive/1/Lab1/BinAdd.html - Do not use the built in addition functions of Matlab. You should just use if statements, loops, logical operations (like and or etc), but no addition nor multiplication, subtraction or division - Check your results on a few examples in binary to make sure that the code works 2) Floating point encoding: Matlab uses by default the 64 bit floating point format to encode numbers: 1 bit for the sign of the number, 1 bit for the sign of the exponent, 52 bit for the significand and 10 bit for the exponent a) Compute the corresponding machine epsilon (check your result using the command "eps") b) How many significant digits does the significand have (in base 10)? Check this by using the format long command c) Determine the highest possible number that can be encoded in the 64 bit float format, and check your result using Matlab

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions