Matrix is singular to working precision

M = [0 0 0 0 -1 0 0 0 0 0 1 0 ;
0 0 0 0 0 1 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 -R -1 ;
1 0 0 0 0 0 0 0 -1 0 -1 0;
0 -1 0 0 0 0 0 1 0 0 0 0;
(-OA/2) 0 0 0 0 0 0 0 (-OA/2) 0 R 0;
-1 0 1 0 0 0 0 0 0 0 0 0;
0 1 0 1 0 0 0 0 0 0 0 0;
(-0.4*sind(20)) (-0.4*cosd(20)) (-0.4*sind(20)) (0.4*cosd(20)) 0 0 0 0 0 0 0 0;
0 0 1 0 0 0 -1 0 0 0 0 0;
0 0 0 -1 0 0 0 1 0 0 0 0;
0 0 (BD/2) 0 0 0 (BD/2) 0 0 0 0 0];
X = [(0);
(mDrum*G);
(mDrum*RDrum^2.*alpha);
(mOA*acOAx);
(mOA*G*acOAy);
((1/12)*(OA)*(0.3)^2.*aaOA);
(mOA*acABx);
(mOA*G*acABy);
((1/12)*(mAB)*(AB)^2.*aaAB);
(mBD*acBDx);
(mBD*G*acBDy);
((1/12)*(mBD)*(BD)^2.*aaBD)];
Forces = M\X
can anyone see whats wrong? i only get NaN exept the last entry there i get inf

1 件のコメント

KSSV
KSSV 2022 年 4 月 28 日
All the varibles are not defined.

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

回答 (2 件)

Walter Roberson
Walter Roberson 2022 年 4 月 28 日

1 投票

Look at the third-last column of M, and notice that it is all zero. When you have a column that is all zero then the column rank of the matrix is reduced by 1. By symmetry in the way determinants are calculated, for square matrices that implies the row rank is also reduced by 1. So your rank is at most 11.
syms R OA BD
Sind = @(x) sind(sym(x));
Cosd = @(x) cosd(sym(x));
M = [0 0 0 0 -1 0 0 0 0 0 1 0 ;
0 0 0 0 0 1 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 -R -1 ;
1 0 0 0 0 0 0 0 -1 0 -1 0;
0 -1 0 0 0 0 0 1 0 0 0 0;
(-OA/2) 0 0 0 0 0 0 0 (-OA/2) 0 R 0;
-1 0 1 0 0 0 0 0 0 0 0 0;
0 1 0 1 0 0 0 0 0 0 0 0;
(-0.4*Sind(20)) (-0.4*Cosd(20)) (-0.4*Sind(20)) (0.4*Cosd(20)) 0 0 0 0 0 0 0 0;
0 0 1 0 0 0 -1 0 0 0 0 0;
0 0 0 -1 0 0 0 1 0 0 0 0;
0 0 (BD/2) 0 0 0 (BD/2) 0 0 0 0 0];
M
M = 
size(M)
ans = 1×2
12 12
rank(M)
ans = 11
Jan
Jan 2022 年 4 月 28 日

0 投票

Why do you assume, that something is wrong? The provided matrix is near to singular. In 1-D this would mean, that you try to divide by a number, which is almost zero. This is not a bug, but a mathematical observation.
Maybe there is a typo in the definition of M. There is no chance that the readers can guess, where it is.
The accessive use of parentheses in the definition of X is an overkill. It impedes the reading only. For writing M it is safer to separate the columns with commas to avoid ambiguities.

カテゴリ

ヘルプ センター および File ExchangeMathematics and Optimization についてさらに検索

タグ

質問済み:

2022 年 4 月 28 日

回答済み:

2022 年 4 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by