When breaking down a (long and complex) formula into the form , I use the approach of the lincoeffs script. The problem is, that I still have u in b, because simplification isn't detecting that the terms cancel out.
Is there a trick to force the elimination of u-terms?
The symbolic expression is attached if you want to try it, the code is as follows:
ddddh_fun_formula = formula(ddddh_fun) == 0;
[ddddh_fun_A,ddddh_fun_b] = lincoeffs(ddddh_fun_formula,u)
ddddh_fun_b = simplify(ddddh_fun_b,'Steps',50);
---
ddddh_fun = expand(ddddh_fun);
ddddh_fun_formula = formula(ddddh_fun) == 0;
[ddddh_fun_A,ddddh_fun_b] = lincoeffs(ddddh_fun_formula,u)
ddddh_fun_b = simplify(ddddh_fun_b,'Steps',50);
The problem with this is, that the very expanded expression from the working version isn't very readable when I do export is as Latex, which is necessary for me.
To read the symbolic function and the matlabFunction derived from this is also very hard this way.