'expression block in xcos gives "answer given for scilab expression is wrong" error

I'm trying to use the xcos/scicos expressionless block:

enter image description here

with this scilab/scicoslab expression:

sign(u2 – u1) * (2 * ((Fm + M) * abs(u2 – u1) + k * (u2^2 – u1^2) / 2) / m)^0.5

where all the variables above has already been defined in the context. But it keeps giving me random errors:

enter image description here

answer given for scilab expression is incorrect...

I would appreciate if you could help me know what is the probelm and how I can solve it.



Solution 1:[1]

OK, I checked the expression block's description and it seems it does not support power or sqrt! The only supported functions are:

sin, cos, tan, exp, log, sinh, cosh, tanh, int, round, ceil, floor, sign, abs, max, min, asin, acos, atan, asinh, acosh, atanh, atan2, log10.

There is the Scilab function block which is much more handy:

enter image description here

There you can call user-defined Scilab functions. I have explained the procedure here in details.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1