Hi I to gant to convert binary to gray.
K=[1 2 0 9];
K_1=dec2bin(K);
K_2=bin2gray(K_1);
The results of K_1 is
'0001'
'0010'
'0000'
'1001'
result of K_2 is
'0001'
How to get graycode values for K

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 8 月 31 日
編集済み: KALYAN ACHARJYA 2019 年 8 月 31 日

0 投票

How to get graycode values for K?
K=[1 2 0 9];
K_1=dec2bin(K);
K_2=bin2dec(K_1)

3 件のコメント

sadiqa ilyas
sadiqa ilyas 2019 年 8 月 31 日
i want gray code values.bin2gray is a function that converts binary values to gray values
function g = bin2gray(b)
g(1) = b(1);
for i = 2 : length(b);
x = xor(str2num(b(i-1)), str2num(b(i)));
g(i) = num2str(x);
end
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 8 月 31 日
編集済み: KALYAN ACHARJYA 2019 年 8 月 31 日
What would be expected result?
Is this same as K ?
sadiqa ilyas
sadiqa ilyas 2019 年 8 月 31 日
It should be like 0001 1011 0000 1101

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeData Type Conversion についてさらに検索

質問済み:

2019 年 8 月 31 日

コメント済み:

2019 年 8 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by