Asked by Xingde
on 2 Apr 2013

% For version1, we can get the expected answer. but for version2, p==0.3 and p==0.7 give us all zeros?

% What's wrong here? Any comments are welcome!

%% compare version1 and version2

%version1 p = 0.1:0.1:0.9; for q = 0.1:0.1:0.9 r = (p==q) end

%version2 p==0.2,p==0.3,p==0.7,p==0.8

*No products are associated with this question.*

Answer by Image Analyst
on 2 Apr 2013

Accepted answer

It's discussed in the FAQ: http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments