MATLAB: Unexpected behaviour of symbolic substitution

symbolicSymbolic Math Toolbox

Hey, If the code attached below is executed, the result shows '\\\nb(t)' somewhere in the expression. I do not know why this happens or what that could mean. The code is not a mimimum example, since this happens only in this case. I am making use of symbolic substitutions in many occations and so far I have not come across problems. The expressions, that are defined (i.e. 'g' and 'h(t)'), seem to be fine (for example when viewed in a MuPAD notebook). Looking forward to any help! Moritz
syms a(t) b(t) c(t) h(t) u1(t) k1 k2 k3
g = diff(a(t), t) == u1(t) + (b(t)*diff(c(t), t, t) - diff(b(t), t)*diff(c(t), t) + k3*b(t)^2*diff(c(t), t))/(k3*b(t)^2) - k1*a(t)*b(t)^2;
h(t) = (2*diff(b(t), t)^2*diff(c(t), t) + b(t)^2*diff(c(t), t, t, t) - 2*b(t)*diff(b(t), t)*diff(c(t), t, t) - b(t)*diff(c(t), t)*diff(b(t), t, t) + k2*b(t)^2*diff(c(t), t, t) + k3*b(t)^3*diff(c(t), t, t) + k2*k3*b(t)^3*diff(c(t), t) - k2*b(t)*diff(b(t), t)*diff(c(t), t))/(k1*k2*k3*b(t)^5);
subs(g, a(t), h(t));

Best Answer

  • \\\n is just a line break. This happens when the formula being displayed is very long. This is just a command to tell a text editor to display the formula on several lines, should you export the results to a text file. This is just a display artefact that you can ignore, it has no impact on the mathematical meaning of your equation.