MATLAB: Problems with an if-else statement

bus farehomeworkif statement

Best Answer

For the distance < 1 case, you need ceil(distance) not round(distance). And this
theta=2+(9*0.25)+((rdistance-1)*0.1);
needs to be this:
theta=2+(9*0.25)+((rdistance-10)*0.1);