How to find binary value?
1 回表示 (過去 30 日間)
古いコメントを表示
Hello I want to calculate following in matlab. Please help in the code or command.
1. I want to represent 25.34 decimal to binary. 2. Do the reverse operation for the above answer.
3. I want to represent -3.4 decimal to binary (in 2's complement form) 4. Do the reverse operation for the above answer.
0 件のコメント
回答 (2 件)
Eike
2011 年 2 月 23 日
Since the matlab integrated function dec2bin seems to be unable to handle numbers with decimal places, I'd suggest to write a little conversion algorithm. That one isn't too complex, you could start at wikipedia for example:
0 件のコメント
Walter Roberson
2011 年 2 月 23 日
Hint: num2hex, a look-up table, and logical indexing.
There are numerous ways to represent floating point numbers in binary. The above hint has to do with the IEEE 754 standard representation. There are other representations, however. I have posted the code for some of them in the past, but as this question is obviously homework, you will at least have to use your search engine skills to find my code.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!