The following Matlab project contains the source code and Matlab examples used for convert a symbolic expresion to a vector.
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]
.

The source code and files included in this project are listed in the project files section, please make sure whether the listed source code meet your needs there.

## Project Files:

File Name | Size |
---|---|

license.txt | 1318 |

sym2vec.m | 564 |