Create n symbolic variables

5 Ansichten (letzte 30 Tage)
one plus one is two
one plus one is two am 25 Okt. 2018
Kommentiert: madhan ravi am 20 Nov. 2018
Hi, I would like to know if there's a way to create n differente symbolic variables (n is an input). Thank's in advanced

Akzeptierte Antwort

madhan ravi
madhan ravi am 25 Okt. 2018
Bearbeitet: madhan ravi am 25 Okt. 2018
EDITED
n=input('value of n?')
syms(sym('a',[1 n]))
a=(sym('a',[1 n])) %storing symbolic variables in a vector for convenience and also to use indexing
command window displays:
value of n?10
n =
10
a =
[ a1, a2, a3, a4, a5, a6, a7, a8, a9, a10]
>> a(1:6)
ans =
[ a1, a2, a3, a4, a5, a6]
>>
  9 Kommentare
one plus one is two
one plus one is two am 20 Nov. 2018
Sorry for the late, thank you so much for your help!
madhan ravi
madhan ravi am 20 Nov. 2018
Anytime :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by