Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I tried this for so long but keep getting an empty array back. Can someone help? Thanks! Part I: Converting an Integer to Binary and

I tried this for so long but keep getting an empty array back. Can someone help? Thanks!

image text in transcribed

Part I: Converting an Integer to Binary and Back For the first part of this assignment you will write a MATLAB function int2bin8 to convert an integer x in the range -127 s x S 128 into its binary representation, and a second function binzint8 to convert from binary to integer. To get you started, the following pseudocode gives you the basic structure of int2bin8 function s = nt2bin8(X) % int2bin8: % Explanation of what the function does is x in the range [-127,128]? num x + bias for i from 7 to 0 decreasing by 1 compute remainder of num, and 2 concatenate '0' or '1' to s accordingly reset the value of num end For the bin2int8 function, which takes an 8-bit binary string s as input and outputs an integer x, your function should start with function x = bin2intS(S) % bin2int8: % Explanation of what the function does You will then need to ensure that the input is indeed an 8-bit binary string (for which the strlength and assert functions will be useful), check the bits of the input for which powers of 2 to add to the result, and apply the bias to compute the decimal value for the output x Part I: Converting an Integer to Binary and Back For the first part of this assignment you will write a MATLAB function int2bin8 to convert an integer x in the range -127 s x S 128 into its binary representation, and a second function binzint8 to convert from binary to integer. To get you started, the following pseudocode gives you the basic structure of int2bin8 function s = nt2bin8(X) % int2bin8: % Explanation of what the function does is x in the range [-127,128]? num x + bias for i from 7 to 0 decreasing by 1 compute remainder of num, and 2 concatenate '0' or '1' to s accordingly reset the value of num end For the bin2int8 function, which takes an 8-bit binary string s as input and outputs an integer x, your function should start with function x = bin2intS(S) % bin2int8: % Explanation of what the function does You will then need to ensure that the input is indeed an 8-bit binary string (for which the strlength and assert functions will be useful), check the bits of the input for which powers of 2 to add to the result, and apply the bias to compute the decimal value for the output x

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

Question

Discuss how much information we can consciously attend to at once.

Answered: 1 week ago

Question

Write formal proposal requests.

Answered: 1 week ago

Question

Write an effective news release.

Answered: 1 week ago

Question

Identify the different types of proposals.

Answered: 1 week ago