Reputation: 327
I am creating a matrix of symbols and I declare a function using them:
x = syms('x', [1 2]);
f = x(1) + x(2)
So x and f are:
x = [x1 x2];
f = x1 + x2
Now I want to give values to x1
and x2
in a for loop and evaluate f
. But when I use:
x(1) = value;
then x
becomes:
x = [1 x2]
and x1
is lost, so I cannot evaluate f
. How can I assign a value to x1
, x2
, ..., xn
and then evaluate f
?
Upvotes: 0
Views: 73