Why the result of this code
B1 = 0:0.1:1.8;B2 = linspace(0,1.8,19)B1(4)-0.3B2(4)-0.3
is 5.5511e-17? I found a workaround, which is
B1 = 0:01:18;B1 = B1/10;
But I am still wondering why the first code does not produce what it should?
floating pointlinspaceMATLAB
B1 = 0:0.1:1.8;B2 = linspace(0,1.8,19)B1(4)-0.3B2(4)-0.3
B1 = 0:01:18;B1 = B1/10;
Best Answer