Why is there a difference between the elements of arrays created by the colon operator with the same step size?
If I create two arrays as follows and compare them, I get the following:
>> scan_period = 0.12; beam_param = 13;
>> dt = scan_period/beam_param;
>> TIME = 0.2189;
>> T = 0:dt:TIME;
>> legTime=0:dt:scan_period;
>> legTime – T(1:14)
ans =
1.0e-16 *
0 0 0 0 0 0 0 0.1388 0 0 0.1388 0.1388 0 0.1388
Why is there a difference between the elements of both arrays when they were created with the same step size?If I create two arrays as follows and compare them, I get the following:
>> scan_period = 0.12; beam_param = 13;
>> dt = scan_period/beam_param;
>> TIME = 0.2189;
>> T = 0:dt:TIME;
>> legTime=0:dt:scan_period;
>> legTime – T(1:14)
ans =
1.0e-16 *
0 0 0 0 0 0 0 0.1388 0 0 0.1388 0.1388 0 0.1388
Why is there a difference between the elements of both arrays when they were created with the same step size? If I create two arrays as follows and compare them, I get the following:
>> scan_period = 0.12; beam_param = 13;
>> dt = scan_period/beam_param;
>> TIME = 0.2189;
>> T = 0:dt:TIME;
>> legTime=0:dt:scan_period;
>> legTime – T(1:14)
ans =
1.0e-16 *
0 0 0 0 0 0 0 0.1388 0 0 0.1388 0.1388 0 0.1388
Why is there a difference between the elements of both arrays when they were created with the same step size? eps, floating-point, accuracy, colon MATLAB Answers — New Questions