For some transfer functions, the built in simplification correctly removes the common factors without a problem. For others, small numerical errors accumulate, eventually leading the routine not to simplify properly. Example:
J = 0.01
b = 0.1
K = 0.01
R = 1
L = 0.5
s = tf([1, 0],[1])
P_motor = K/((J*s + b)*(L*s +R) + K^2)
For some transfer functions, the built in simplification correctly removes the common factors without a problem. For others, small numerical errors accumulate, eventually leading the routine not to simplify properly. Example:
Running:
outputs:
When it should output:
This is most likely due to accumulated error in the recursive division in
gcd
.