Convert a symbolic expresion to a vector

convert a symbolic expression to a vector with length of the number of terms of the expression

Vous suivez désormais cette soumission

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 (2026). Convert a symbolic expresion to a vector (https://fr.mathworks.com/matlabcentral/fileexchange/43479-convert-a-symbolic-expresion-to-a-vector), MATLAB Central File Exchange. Extrait(e) le .

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et MATLAB Answers

Informations générales

Compatibilité avec les versions de MATLAB

  • Compatible avec toutes les versions

Plateformes compatibles

  • Windows
  • macOS
  • Linux
Version Publié le Notes de version Action
1.0.0.0