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 téléchargements
Mise à jour 13 sept. 2013

Afficher la licence

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]

Citation pour cette source

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. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2013a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.0.0.0