error in subtracting
조회 수: 10 (최근 30일)
이전 댓글 표시
I have a code
if Sparse_Conc_Index>=1
---------
---------
---------
Class_Image = (Image_Path);
figure,imshow(Class_Image)
else
msgbox('Invalid Image ','ALERT')
end
if i do
F=1-Sparse_Conc_Index
i get
F = 5.1341e-011
please tell how to get F as zero
채택된 답변
Walter Roberson
2012년 6월 27일
If F = 1 - Sparse_Conc_Index is positive, then Sparse_Conc_Index >= 1 is false, so your "if" should not be true.
Your problem then reduces down to why Sparse_Conc_Index is not at least 1, which is something we do not know as you do not show how you calculated Sparse_Conc_Index .
댓글 수: 0
추가 답변 (1개)
Andreas Goser
2012년 6월 27일
The point is that 5.1341e-011 IS actually almost zero. It depends now on your application what is the best approach. Very often comparisions are made in a way that you don't compare with ==, but with a tolerance.
참고 항목
카테고리
Help Center 및 File Exchange에서 Dynamic System Models에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!