I am facing some problem in comparing difference of two variables with some threshold value. Here is the part of code belongs to it.
R_miss_old = 1.0e+003 * Columns 1 through 8 0 0 0 0 0 0 0 0 Columns 9 through 16 0 0 0 0 0 0 0 1.3169
and
R_miss_new = 1.0e+003 * Columns 1 through 8 0 0 0 0 0 0 0 0 Columns 9 through 16 0 0 0 0 0 0 0 1.1970
now I want to check whether the difference between above two is less than some threshold value (lets say d=0.001) or not for this I did
if (abs(R_miss_new-R_miss_old)<d) disp('Smaller')elseif (abs(R_miss_new-R_miss_old)>d) disp('Greater')end
But I am not getting any result. How can I perform this operation ? Did I make any mistake while calculating R_miss_old or R_miss_new ?
Best Answer