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

6 visualizaciones (últimos 30 días)
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

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 13 de Jun. de 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

Más respuestas (0)

Categorías

Más información sobre Formula Manipulation and Simplification en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by