so I make a vector:(adsbygoogle = window.adsbygoogle || []).push({});

V3 = [15.05:.05:15.15];

V3c = [14.75:.05:15.15];

find(V3c == Vc(2))

and I get nothing (no matches)

apparently, when matlab constructed V3, it did so such that:

V3(2) == 15.10000000000001

and

V3c(8) == 15.10000000000000

what's the deal?

My cheap way around this is:

V3 = fix(V3*1000)/1000

so I multiply by 1000, shave off the remaining decimals, and divide by 1000, but this doesn't seem robust to me. Is there a better way to handle this floating point difference?

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab floating point

**Physics Forums | Science Articles, Homework Help, Discussion**