version (2 KB) by Gopinath
To convert decimal fraction to fixed point binary number


Updated 8 Sep 2014

View License

dfrac2bin function converts a decimal fraction to a fixed point representation. Negative numbers are directly converted into 2's complement numbers. The inputs are as below.
x: Any decimal fraction number
number_of_bits_int: Number of bits used to represent integer part
number_of_bits_fr : Number of bits used to represent fraction part
format : format in which we want outputs ... 'dec' or 'bin'. sign_required: A flag whether to include sign bit in the output expression.

Cite As

Gopinath (2022). dfrac2bin.m (https://www.mathworks.com/matlabcentral/fileexchange/47759-dfrac2bin-m), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!