What is the easier way of listing several symbolic variables?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
is there a way to list symbolic variables without having to type each one of them? I mean, sometimes I am dealing with several variables, say x1,x2,....,x20; so what would be the 'easiest' way of writing them?
Would
syms x1... x20
work ? (or something similar) ?
0 comentarios
Respuestas (2)
Azzi Abdelmalek
el 28 de En. de 2013
Editada: Azzi Abdelmalek
el 28 de En. de 2013
for k=1:20;
syms(sprintf('x%d',k));
end
0 comentarios
Sean de Wolski
el 28 de En. de 2013
for ii = 1:20;
syms(['x' num2str(ii)]);
end
But more importantly, can you represent it as one 1x20 vector instead?
2 comentarios
Sean de Wolski
el 28 de En. de 2013
x = sym(zeros(1,20))
Now fill them in with whatever. E.g.:
x(3) = sym('d')
It's just a thought, there might not be a way around it. Basically we're trying to get away from this, though it is terribly convenient (and sometimes necessary) with symbolic variables.
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!