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

Respuestas (2)

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 el 28 de Abr. de 2022

0 votos

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.

Categorías

Más información sobre Mathematics and Optimization en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de Abr. de 2022

Respondida:

el 28 de Abr. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by