why taking mod this problem is occur ? where is the problem.

조회 수: 4 (최근 30일)
Sultan Mehmood
Sultan Mehmood 2019년 6월 28일
댓글: Torsten 2019년 6월 28일
r = 3.8;
size = 9;
L(1)= 0.23;
for i=2:size
L(i) = r*L(i-1)*(1-L(i-1));
end
for i=1:9
S(i)=floor(abs(L(i)));
A(i)=abs(L(i));
D(i)=(A(i)-S(i))*10^14;
K(i)=mod(D(i),256);
end
and why some values of k in decimal points.?

채택된 답변

Guillaume
Guillaume 2019년 6월 28일
Why not? Have you looked at your A (which is equal to L)? None of its values are integer. The remainder of a division of a non-integer value by an integer is never going to be an integer, so it's no surprise that mod return non-integer values.
Notwithstanding the fact that none of the loops are needed (the first one can be replaced by filter), have you also noticed that your S is all 0s? I suspect you coded the whole thing completely wrong. Like your previous question you do not explain what the overall goal is.
  댓글 수: 1
Torsten
Torsten 2019년 6월 28일
I did not check whether one of the L's has more than 14 decimal places ...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Code Generation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by