cell array error using equationsToMatrix function

1 回表示 (過去 30 日間)
Emiliano Rosso
Emiliano Rosso 2023 年 4 月 6 日
回答済み: Emiliano Rosso 2023 年 4 月 6 日
Hi
in reference to :
I must use this code :
syms x y z
eqn1 = 2*x + y + z == 2;
eqn2 = -x + y - z == 3;
eqn3 = x + 2*y + 3*z == -10;
[A,B] = equationsToMatrix([eqn1, eqn2, eqn3], [x, y, z])
but using cell array.
So I do:
a=cell(1,3);
b=cell(1,3);
a{1}=eqn1;a{2}=eqn2;a{2}=eqn3;
b{1}=x;b{2}=y;b{3}=z;
Using one cell at a time I obtain the same results :
[A,B] = equationsToMatrix([a, [x, y, z]);
[A,B] = equationsToMatrix([eqn1, eqn2, eqn3], b)
but when I use both :
[A,B] = equationsToMatrix(a, b)
Check for missing argument or incorrect argument data type in call to function 'equationsToMatrix'.
How to solve this error?
Thanks!

採用された回答

Emiliano Rosso
Emiliano Rosso 2023 年 4 月 6 日
Instead of using cell use syms:
a=syms(1,3);
b=syms(1,3)
a(1)=eqn1;a(2)=eqn2;a(3)=eqn3;
b(1)=x;b(2)=y;b(3)=z;
[A,B] = equationsToMatrix(a, b);

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by