Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.

1 次查看(过去 30 天)
I have coding such as this:
En = length(n); % n = number of data tottaly
Ex1= sum(x1); % Ex1= number of Depth
Ex2= sum(x2); % Ex2= number of Amax
Ex3= sum(x3); % Ex3= number of Mw
Ex4= sum(x4); % Ex4= number of Vs
Ex5= sum(x5); % Ex5= number of Distance
x1x2= dot(x1,x2);
x1x3= dot(x1,x3);
x1x4= dot(x1,x4);
x1x5= dot(x1,x5);
Ex1x2=sum(x1x2);
Ex1x3=sum(x1x3);
Ex1x4=sum(x1x4);
Ex1x5=sum(x1x5);
x1_2 = x1.^2;
x2_2 = x2.^2;
x3_2 = x3.^2;
x4_2 = x4.^2;
x5_2 = x5.^2;
Ex1_2 = sum(x1_2);
Ex2_2 = sum(x2_2);
Ex3_2 = sum(x3_2);
Ex4_2 = sum(x4_2);
Ex5_2 = sum(x5_2);
Ey1=sum(y1);
x1_y1=dot(x1,y1);
x2_y1=dot(x2,y1);
x3_y1=dot(x3,y1);
x4_y1=dot(x4,y1);
x5_y1=dot(x5,y1);
Ex1_y1=sum(x1_y1); %Ex1_y = number x1 multiplyied y
Ex2_y1=sum(x2_y1); %Ex2_y = number of x2 multiplied by y
Ex3_y1=sum(x3_y1);
Ex4_y1=sum(x4_y1);
Ex5_y1=sum(x5_y1);
A = [En Ex1 Ex2 Ex3 Ex4 Ex5;Ex1 Ex1_2 Ex1x2 Ex1x3 Ex1x4 Ex1x5;Ex2 Ex2_2 Ex1x2 Ex1x3 Ex1x4 Ex1x5;...
Ex3 Ex3_2 Ex1x2 Ex1x3 Ex1x4 Ex1x5;Ex4 Ex4_2 Ex1x2 Ex1x3 Ex1x4 Ex1x5;Ex5 Ex5_2 Ex1x2 Ex1x3 Ex1x4 Ex1x5];
At = A';
G = [Ey1;Ex1_y1;Ex2_y1;Ex3_y1;Ex4_y1;Ex5_y1];
Ai = inv(At);
I want to make an inversion task but, I got the massage like this "Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN"
Is there any one can help me to slove my probelm?
Thx
  2 个评论
David Goodmanson
David Goodmanson 2019-2-19
Hi Akhmad,
It's better to post a small matrix like this as text rather than image, so it can be copied and used directy. Also the numbers in the first column are cut off, However, just from looking at the image,
for row 3, the values in columns 2 through 6 are identical.
for row 4, the values in columns 2 through 6 are identical.
for row 5, the values in columns 2 through 6 are identical.
for row 6, the values in columns 2 through 6 are identical.
and from this it is not hard to show that row 5 is a linear combination of rows 3 and 4, and row 6 is also a linear combination of rows 3 and 4. Either on of those is enough to make the matrix singular. I believe you need to go back to square one and look at how you are building the elements of the matrix.

请先登录,再进行评论。

采纳的回答

Skydriver
Skydriver 2019-2-19
Yes it works now, thank you David Goodmanson

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Signal Processing 的更多信息

产品


版本

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by