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

1 view (last 30 days)
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 Comments
David Goodmanson
David Goodmanson on 19 Feb 2019
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.

Sign in to comment.

Accepted Answer

Skydriver
Skydriver on 19 Feb 2019
Yes it works now, thank you David Goodmanson

More Answers (0)

Categories

Find more on Signal Processing in Help Center and File Exchange

Products


Release

R2013a

Community Treasure Hunt

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

Start Hunting!