Error evaluating symbolic expressions with symbolic arrays.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
pefernan
am 19 Apr. 2017
Beantwortet: Walter Roberson
am 19 Apr. 2017
I get an error when I run this code (R2017a):
x = sym('x',[1 3]);
y = x(1) + x(2) + x(3);
x(1)=1;
x(2)=1;
x(3)=1;
double(subs(y))
If instead of an array of syms I use separate syms variables, the code runs with no errors. This is the error I get:
Error using symengine
DOUBLE cannot convert the input expression into a double array.
Error in sym/double (line 643)
Xstr = mupadmex('symobj::double', S.s, 0);
How can I fix this mantaining the array of syms? It would be great to keep the array as I need to use large arrays of syms.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 19 Apr. 2017
x(1)=1; does not set x1 to 1: it changes the vector x to [1, x2, x3]
Instead,
X = [1, 1, 1];
subs(y, x, X)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Assumptions finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!