How to solve an linear set of equations with arbitrary number of symbolic elements

1 回表示 (過去 30 日間)
I defined my U, with an arbitrary lenght due to the preferable N_elements
U = sym('U',[N_elements+1 1]);
Now I want to solve my linear set of equations by
FU_antwoord = solve(eq,[U(2), U(3), U(4), U(5)]);
This works, but only for N_elements= 4. Now I tried to make it work for an arbitrary chose N_elements, with a dummy-element U_t
U_t = U';
FU_antwoord = solve(eq,[ U_t(2:end)]
But this did not work (since the symbolic elements get transposed?), giving the error: Second argument must be a vector of symbolic variables.
Anyone know how I can solve this?
  4 件のコメント
Frank Oosterveld
Frank Oosterveld 2018 年 11 月 12 日
Concludingly, I want to make an script such that ,
FU_antwoord = solve(eq,[F(1), U(2), U(3), U(4), U(5)])
Becomes for N_elements =5
FU_antwoord = solve(eq,[F(1), U(2), U(3), U(4), U(5), U(6)])
N_elements =6
FU_antwoord = solve(eq,[F(1), U(2), U(3), U(4), U(5), U(6), U(7)])
etcetera
Walter Roberson
Walter Roberson 2018 年 11 月 12 日
[F(1), U(2:end-1).']

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2018 年 11 月 12 日
U_t = U.';
Remember that the ' operator is conjugate transpose.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by