Solution for a homogeneous equation using null space
2 次查看(过去 30 天)
显示 更早的评论
I have a homogeneous equation group as follows
A*b=0;where A is a 8 by 8 matrix, b is a 8 by 1 vector.
I have calculated that det(A)=5.141078303798737e-010, close to zero, so i use null(A) to find out the solution b, however i got a result like "Empty matrix: 8-by-0", I have checked the rank of the matrix A and got Rank(A)=8, since the determinant of A is close to zero, i thought that rank(A) should be smaller than 8 and I should be able to use null space to solve b. Any one can suggest a way to solve b?
Thanks.
Mike
5 个评论
Wayne King
2012-2-22
Oh, thank you Sean!! sorry I don't why it didn't occur to me that was sparse(A)
回答(6 个)
John D'Errico
2012-2-22
Sigh. The determinant is a TERRRRRRRRRRRIBLE way to check for singularity. Godawful. A miserable computational tool, good only for homework problems. Did I say it was bad? Three times I've said it, so this must be true.
Do you need an example? Compute the determinant of
A = eye(8);
det(A)
ans =
1
Yes, it is clearly nonsingular, and det predicted that. Since you used 1e-10 as a measure that a matrix must be singular, can we modify A just so subtly and get a determinant that small? How about this?
det(A*.05)
ans =
3.9063e-11
Oops. I could have sworn that this matrix is also diagonal, just with 0.05 elements down the diagonal. Surely this is just as nonsingular as the original identity matrix was.
Gosh. I wonder why I should think it is singular just because det says so? I suppose if I go to extremes I can get a true underflow zero.
det(A*1e-50)
ans =
0
Is that matrix any more singular than the others?
Why do people insist on using det?
3 个评论
John D'Errico
2012-2-23
Don't use det. Period. PERIOD. PERIOD! Need I repeat myself? Under NO circumstances would I EVER advise that someone use det to test for singularity.
Rank is a good choice. An svd is a good choice, but of course rank is based on the svd.
harry wang
2012-2-23
1 个评论
Dipendra Subedi
2021-3-21
I have the same issue. The null(A) returns empty matrix (specially when used inside a loop which is very strange) but the above implementation works fine (in and out of the loop).
Wayne King
2012-2-22
Hi Harry, I get a rank of 6 for this matrix and therefore expect the nullspace to have dimension 2. I get the following ONB for the nullspace:
-0.000000000000020 -0.756171511092082
0.000000000000013 0.434311342718816
0.339775797713826 -0.065890507565062
-0.339775797713829 -0.065890507565044
-0.756171511092085 0.000000000000021
0.434311342718811 -0.000000000000010
-0.065890507565062 -0.339775797713825
-0.065890507565044 0.339775797713829
harry wang
2012-2-22
1 个评论
Wayne King
2012-2-23
I see what you mean, but do you really need this kind of precision in your matrix?
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!