Why does the SUBS command not substitute correctly for a symbolic term of variables?
7 views (last 30 days)
Show older comments
MathWorks Support Team
on 27 Jun 2009
Edited: MathWorks Support Team
on 13 Jun 2018
Why does the SUBS command not substitute correctly for a symbolic term of variables?
SUBS does not replace symbolic terms that contain only multiplication operators.
For example:
» syms r q z s;
f2=(r*q+1)*s;
C = maple('coeff',f2,s,1);
subs(f2,C,'C')
ans =
C*s
however,
» f1=(r*q)*s;
C = maple('coeff',f1,s,1);
subs(f1,C,'C')
ans =
r*q*s
Accepted Answer
MathWorks Support Team
on 13 Jun 2018
This behavior has been submitted to our development staff as a bug.
As a workaround, you can change the symbolic variables to a string and then perform the SUBS command. You can do this with the CHAR command in the following manner:
The CHAR command in MATLAB creates character arrays. For more information information on how to use the syntax, please refer to the MATLAB User's Guide function reference at the URL below :
f1=(r*q)*s;
C = maple('coeff',f1,s,1);
subs(f1,char(C),'C')
ans =
(C)*s
0 Comments
More Answers (0)
See Also
Categories
Find more on Assumptions 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!