Create x(1) x(2)... variable vector using sym

I am looking for a way to create a vector with variables [x(1) x(2)..] It is important to have them in the format including () since they will be passed to a function after they were multiplied by a vector of numbers.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de Nov. de 2016
for K = 1 : 10
x(K) = evalin(symengine, sprintf('x(%d)', K));
end
Using them in the other function is a different matter. The Symbolic Engine will tend to treat them as function calls to an unresolved function. For example you will not be able to diff() with respect to one of them.

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 19 de Nov. de 2016

Respondida:

el 19 de Nov. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by