Convert a symbolic expresion to a vector

convert a symbolic expression to a vector with length of the number of terms of the expression
235 descargas
Actualizado 13 sep 2013

Ver licencia

Convert each expression to a vector with length of the number of terms of an expression:
for example:
syms x a b c
r= a*x^2+b*x+c-exp(x)
R=sym2vec(r);
results in:
R =
[ c, -exp(x), b*x, a*x^2]

Limitations:
this is a rude way to solve the issue, the expression r always is expanded before assign to the vector
for example:
r = x*(a+b)+x
R=sym2vec(r)
you should have:
R=
[ x*(a+b), x]
but instead, you have:
R =
[ x, a*x, b*x]

Citar como

Luis Erasmo Miranda (2024). Convert a symbolic expresion to a vector (https://www.mathworks.com/matlabcentral/fileexchange/43479-convert-a-symbolic-expresion-to-a-vector), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2013a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y MATLAB Answers.

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión
1.0.0.0