Having trouble with "Matrix is singular to working precision" error, would be glad if you help

4 vues (au cours des 30 derniers jours)
Hello,
I am very new to matlab and frankly to the math also, i was working for a company for a while but decide to start a master and thus the gap between my bachelor and master periods became long. Anyway I am trying to divide two matrix in matlab but it gives singularity error, i would be glad if you help, here are my matrices;
G =
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 2.3177 0 0.4011 -0.0966 0 0 0 0 0 0
0 0 0 0.0594 0.0966 -0.0223 0 0 0 0 0 0
0 0 0.4011 0.0966 2.3177 0 0.4011 -0.0966 0 0 0 0
0 0 -0.0966 -0.0223 0 0.0594 0.0966 -0.0223 0 0 0 0
0 0 0 0 0.4011 0.0966 2.3177 0 0.4011 -0.0966 0 0
0 0 0 0 -0.0966 -0.0223 0 0.0594 0.0966 -0.0223 0 0
0 0 0 0 0 0 0.4011 0.0966 2.3177 0 0.4011 -0.0966
0 0 0 0 0 0 -0.0966 -0.0223 0 0.0594 0.0966 -0.0223
0 0 0 0 0 0 0 0 0.4011 0.0966 1.1589 -0.1634
0 0 0 0 0 0 0 0 -0.0966 -0.0223 -0.1634 0.0297
>> L
L =
1.0e+04 *
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 6.3840 0 -3.1920 1.5960 0 0 0 0 0 0
0 0 0 2.1280 -1.5960 0.5320 0 0 0 0 0 0
0 0 -3.1920 -1.5960 6.3840 0 -3.1920 -1.5960 0 0 0 0
0 0 1.5960 0.5320 0 2.1280 -1.5960 0.5320 0 0 0 0
0 0 0 0 -3.1920 -1.5960 6.3840 0 -3.1920 1.5960 0 0
0 0 0 0 1.5960 0.5320 0 2.1280 -1.5960 0.5320 0 0
0 0 0 0 0 0 -3.1920 -1.5960 6.3840 0 -3.1920 1.5960
0 0 0 0 0 0 1.5960 0.5320 0 2.1280 -1.5960 0.5320
0 0 0 0 0 0 0 0 -3.1920 -1.5960 3.1920 -1.5960
0 0 0 0 0 0 0 0 1.5960 0.5320 -1.5960 1.0640
>> L/G Warning: Matrix is singular to working precision.
ans =
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
thank you for your help and sorry for my english

Réponses (3)

John D'Errico
John D'Errico le 5 Nov 2017
As a guess, since a linear algebra divide makes no sense at all here (i.e., you never said anything about solving a linear system of equations) that you actually wanted to compute the ratio of corresponding elements.
r = L./G;
Yes, that will result in NaN elements where there were zeros. If you don't like NaNs, then do this at the end
r(isnan(r)) = 0;

David Goodmanson
David Goodmanson le 5 Nov 2017
Modifié(e) : David Goodmanson le 5 Nov 2017
Hi utkuzzz,
The command L/G is the same thing as L*inv(G), although computationally L/G is certainly the preferred way to do this. But G has no inverse, because it contains two rows and two columns of zeros. If you are not really concerned about the first two rows and columns, then you can eliminate them and get a result.
G3e = G(3:end,3:end);
L3e = L(3:end,3:end);
L3e/G3e

utkuzzz
utkuzzz le 5 Nov 2017
Wow! I wasn't expecting such quick answers, thank you guys. I got the David's explanation, and it worked for me, but my problem with this staff continues, The thing is my prof. told me to find the first five natural frequencies of a cantilever beam with fixed-end one side without applying any load by using fem. I calculated the [K] and [M] manually and transferred them into mathlab which are G and L i wrote before but i can't solve the problem. Maybe you also know something about this?
  3 commentaires
utkuzzz
utkuzzz le 6 Nov 2017
Actually, no trig functions, I have to get benefit of the following page; http://iitg.vlab.co.in/?sub=62&brch=175&sim=1080&cnt=1
I made it to the last function as i mentioned i have [K] and [M] but still dont have the solution.
David Goodmanson
David Goodmanson le 7 Nov 2017
Well, those are still not K and M since they can't have rows and columns of zeros, just as the example from the link does not. Their example does look a bit complicated.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by