MATLAB: Question regarding dsolve and subs (symbolic toolbox)

dsolveMATLABode'ssubssymsymbolic toolboxsyms

Hi,
I am trying to solve a system of 3, 2nd order differential equations. My equations are very long (1000 lines) even after I do simplify, so I cannot post it here. To explain my question I will use a similar code
syms a b c d x;
eqn1 = sym(subs('D2x+a', a ,'c+b+d'));
S =dsolve(eqn1, x)
this is the code that I use, the difference is I put three equations instead of one here. The output of this code gives me
*warning: Empty equation > In dsolve at 85
S =
[ empty sym ]*
I just need to substitute my equation which is a which is 1000 lines long into my dsolve equations. Can anybody tell me what I am doing wrong or write the syntax for correct way. I think its not taking the eqn1 variable in dsolve
Thanks,
Nitin Nair

Best Answer

subs() has to work on symbolic expressions, but you are passing in a string instead. Also the new value has to be symbolic or numeric. You should use
eqn1 = subs(sym('D2x+a'), a, c+b+d);