Solving for a matrix

11 ビュー (過去 30 日間)
James Bader
James Bader 2018 年 10 月 29 日
コメント済み: James Bader 2018 年 10 月 29 日
Hello all,
I have a matrix and need to invert it( Ax=b) and solve for x. However, I know one aspect of x and only need the others.
K = [7 -8 1 0 0 0 0; -8 16 -8 0 0 0 0; 1 -8 14 -8 1 0 0; 0 0 -8 16 -8 0 0; 0 0 1 -8 14 -8 1; 0 0 0 0 -8 16 -8; 0 0 0 0 1 -8 7];
syms f1 f2 f3 f4 f5 f6 f7 u1 u2 u3 u4 u5 u6 u7
F=[f1; f2; f3; f4; f5; f6; f7];
U=[u1; u2; u3; u4; u5; u6; u7];
eqn = F==K*U;
L = subs(eqn,[f1 f2 f3 f4 f5 f6 f7 u7], [0 0 0 0 0 0 -1 0])
This does give me the vector in terms of unknowns but doesn't actually solve for unknowns; is there a way to code it to do this? I tried U=K\F and it says the system is inconsistent however to my understanding I should be able to get numerical answers for each u aspect.
  2 件のコメント
Matt J
Matt J 2018 年 10 月 29 日
So why is this being done symbolically if you want numerical answers?
James Bader
James Bader 2018 年 10 月 29 日
I did not know another way to enter a system of equations with several unknown variables; it was recommended to me to use symbolic variables.

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

回答 (1 件)

Bruno Luong
Bruno Luong 2018 年 10 月 29 日
編集済み: Bruno Luong 2018 年 10 月 29 日
> K = [7 -8 1 0 0 0 0; -8 16 -8 0 0 0 0; 1 -8 14 -8 1 0 0; 0 0 -8 16 -8 0 0; 0 0 1 -8 14 -8 1; 0 0 0 0 -8 16 -8; 0 0 0 0 1 -8 7]
K =
7 -8 1 0 0 0 0
-8 16 -8 0 0 0 0
1 -8 14 -8 1 0 0
0 0 -8 16 -8 0 0
0 0 1 -8 14 -8 1
0 0 0 0 -8 16 -8
0 0 0 0 1 -8 7
>> cond(K)
ans =
2.7552e+16
>> rank(K)
ans =
6
>> size(K)
ans =
7 7
>>
Essentially that shows your linear system is ill-posed; meaning it either has no solution, and by chance it has (pick the right rhs) it has infinity number of solutions.

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by