Symbolic vector problem in MATLAB

조회 수: 1 (최근 30일)
Berke Ogulcan Parlak
Berke Ogulcan Parlak 2019년 12월 8일
답변: Walter Roberson 2019년 12월 8일
Hi, I'm using the 2016a version and syms doesn't work as a vector.
I try:
syms a [1 4]
but I take "Not a valid variable name" error.
I know I can use sym instead:
sym('a', [1,4])
However, my request is not to use like a (1),I want Matlab to recognize it when I type a1.
  댓글 수: 1
Star Strider
Star Strider 2019년 12월 8일
The only way seems to be to actually type:
syms a1 a2 a3
I experimented with str2sym to do this, without success.
You can use sprintf or compose to create a vector of symbolic variables to manually copy and paste to your syms call :
a = compose("a%d", 1:5)
however that appears to be the only way to do what you want.

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

답변 (1개)

Walter Roberson
Walter Roberson 2019년 12월 8일
syms(sym('a', [1 4]))

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by