Why does the SUBS command not substitute correctly for a symbolic term of variables?

3 vues (au cours des 30 derniers jours)
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

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 13 Juin 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

Plus de réponses (0)

Catégories

En savoir plus sur Formula Manipulation and Simplification dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by