Question regarding dsolve and subs (symbolic toolbox)

18 views (last 30 days)
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

Accepted Answer

Walter Roberson
Walter Roberson on 21 Jan 2012
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);

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!