Question: help with Matlab A) Conversion from decimal to binary Write a function that converts a decimal number into a binary number, with n digits (configurable)

help with Matlab help with Matlab A) Conversion from decimal to binary Write a function

A) Conversion from decimal to binary Write a function that converts a decimal number into a binary number, with n digits (configurable) past the decimal point. For example, if the input number is 1.231 with n=6 should output the binary number "1.001110". Do not use dec2base or dec2bin (or similar) commands of Matlab for the conversion. Hints: - Use the trick seen in class: if x is your input number, compute x2n, round it as an integer (Matlab command: round()), convert the number in base 2 , and then shift the binary point to the left ' n ' times - To convert an integer in base 2, use the procedure seen in class (remainders of successive divisions by 2 ) - Create the output binary number as a string (or chain of characters). You can use the command strcat() to concatenate strings into a bigger string)

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!