You should never eval() a symbolic variable or expression: the language used for symbolic expressions is not exactly the same as MATLAB. You should use subs() if you want to bring in values for variables used in expressions.
You do not assign values to aY21 or aY22 but error is defined in terms of them. What do you expect it to mean to use >= to compare an expression with free variables to a specific numeric value to control the bounds of a while loop ?
In some contexts you can replace comparisons of symbolic expressions with piecewise(), but you would not do that as a bounds test for while -- you would not know whether the condition was satisfied until after you had left the loop for other reasons.
Best Answer