Your final line of F,
sign(x(4)-x(6))*(abs(x(4)-x(6))/f3)^a + sign(x(5)-x(6))*(abs(x(5)-x(6))/f7)^a + sign(x(3)-x(6))*(abs(x(3)-x(6))/f9)^a -r7];
creates a 1 x 2 sym vector.
In all of the other lines, you have a space between the "-" and the last term, such as
sign(x(2)-x(3))*(abs(x(2)-x(1))/f8)^a + sign(x(4)-x(5))*(abs(x(4)-x(5))/f5)^a - sign(x(3)-x(6))*(abs(x(3)-x(6))/f9)^a - r4;
but in the last line you have no space. Without the space, MATLAB interprets the "-" as unary minus, the same way that you can construct
as meaning something different than
Best Answer