Solving for a matrix
11 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Algebra 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!