필터 지우기
필터 지우기

What is the easier way of listing several symbolic variables?

조회 수: 1 (최근 30일)
Del
Del 2013년 1월 28일
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) ?

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 1월 28일
편집: Azzi Abdelmalek 2013년 1월 28일
for k=1:20;
syms(sprintf('x%d',k));
end

Sean de Wolski
Sean de Wolski 2013년 1월 28일
for ii = 1:20;
syms(['x' num2str(ii)]);
end
But more importantly, can you represent it as one 1x20 vector instead?
  댓글 수: 2
Del
Del 2013년 1월 28일
Thanks! Not really...
could you enlighten me on how to do this?
Sean de Wolski
Sean de Wolski 2013년 1월 28일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by