how to convert the fraction part into intger?

3 ビュー (過去 30 日間)
Sultan Mehmood
Sultan Mehmood 2019 年 7 月 16 日
回答済み: TADA 2019 年 7 月 16 日
r = 3.342448;
L(1)= 0.234;
for i=2:4
L(i) = r*L(i-1)*(1-L(i-1));
end
mm=min(L);
nn=max(L);
oo=nn-mm;
Z=uint8(254*((L-mm)/oo))+1;
K = mod((abs (L)-floor (abs (L))) *10e8 , 256)
how i converting the K into intger?

回答 (2 件)

Raj
Raj 2019 年 7 月 16 日
編集済み: Raj 2019 年 7 月 16 日
Use
ceil(K)
or
floor(K)
depending on how you want to round off the fractions.
or
int8(K)
or
int16(K)
or
int32(K)
or
int64(K)
to change the data type from double to integer (respective bit sizes) if that's what you meant.

TADA
TADA 2019 年 7 月 16 日
What about
K = round(mod((abs (L)-floor (abs (L))) *10e8 , 256))
Or
K = floor(mod((abs (L)-floor (abs (L))) *10e8 , 256))

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by