フィルターのクリア

How can i use symbolic variables which were created as a vector?

3 ビュー (過去 30 日間)
Volkan Yangin
Volkan Yangin 2021 年 1 月 12 日
回答済み: KSSV 2021 年 1 月 12 日
Hi,
x_opr=[1 2 3 4 5 6 7 8 9];
syms sv
sv=sym('x',[1 numel(x_opr)])
Output of this command is:
sv =
[ x1, x2, x3, x4, x5, x6, x7, x8, x9]
x1 to x9 will be used in some calculations, but i have an error message: Undefined function or variable 'x2'.
It seems that i have to define x1 to x9 as symbolic again, but i have already wrote them as a vector. Where is my wrong?
Thanks,

回答 (1 件)

KSSV
KSSV 2021 年 1 月 12 日
What you have shown will not work and it is meaning less. You have to use:
x = [1 2 3 4 5 6 7 8 9];
Where veer you have x1, x2, ..x9 etc....use x(1), x(2), .....x(9). Read about matrix indexing in MATLAB.

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by