Question: must be done in matlab Problem 2: a. (15%)Write a function in MATLAB to convert a floating-point number to a decimal number using the formula
Problem 2: a. (15%)Write a function in MATLAB to convert a floating-point number to a decimal number using the formula provided below (the numbers in red, blue and green provide a reference for which bits are used for sign/precision/exponent). Use for loops to plug the bits into the formula rather that writing them in one at a time. (Hint: use one for loop to assign the precision bits and another for the exponent. Once these have been computed separately you can sum and multiply them at the end.) Decoding rule: fp = (-1)= (1 + 2 + 2 + ... + 32) 2(cute102+0,2%+6320++ @ 240) 1023 11000000001010101100000000000000000000000000000000000000000000000 b. (5%) Use your function to convert the number x provided below into decimal: x-(110000000011010100001110000000000000000000000 0000000000000000000)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
