Clear Filters
Clear Filters

problem with rref function

9 views (last 30 days)
Sudipta Sinha
Sudipta Sinha on 22 May 2014
Commented: Sudipta Sinha on 22 May 2014
Hi All,
I was trying to solve a set of linear equations by using rref function. My matrix is a rectangular positive definite and the explicit form of the matrices are attached with this message. However, the rref works fine with matrix1 but it doesn't work for matrix2. The only change between the two matrices is at (13,23) element (68.4900 vs 61.6410). the matrix2 only gives bunch of 0.0s as solution. But my interest to get the numbers from the matrix2. How should i proceed? or where is my wrong.
Any comments will be highly appreciated
Thanks in advance
Sudipta
  2 Comments
John D'Errico
John D'Errico on 22 May 2014
Edited: John D'Errico on 22 May 2014
I know that you THINK you have given us the matrices in question, but you have not, unless that is EXACTLY as those numbers were entered into MATLAB. You have probably provided 7 digit approximations to those matrices. As such, those matrices would be useless as is.
Matt J
Matt J on 22 May 2014
So, if you want to give us the matrices, attach them in a .mat file.

Sign in to comment.

Accepted Answer

Matt J
Matt J on 22 May 2014
You should be using mldivide(), not rref().
  2 Comments
Sudipta Sinha
Sudipta Sinha on 22 May 2014
thanks for advise. any clue why rref doesn't work
Sudipta Sinha
Sudipta Sinha on 22 May 2014
the function mldivide() doesn't work. It produces inf and NAN. I changed the number 68.49 to 68.48 instead of changing 61.64. Still it gives some error, like matrix is close to singular and produces inf and NAN. Please advise me what should I do to solve this issue.

Sign in to comment.

More Answers (1)

John D'Errico
John D'Errico on 22 May 2014
FURTHERMORE ... while you claim that matrix 1 is positive definite, it is a 22x23 matrix. Positive definite it is not.
By definition, a positive definite matrix is square. Time for some reading on your part.
Finally, lets look at Matrix1, AS you have given it to us.
svd(Matrix1)
ans =
5180
896.72
896.4
366.59
283.26
1
1
1
1
0.99998
0.99998
0.81686
0.81613
0.57785
0.57773
0.57772
0.57699
0.57698
0.57687
4.8302e-05
3.5355e-05
1.7948e-14
See that little number at the end? That tells me that your matrix is actually numerically singular as you have provided it.
rank(Matrix1)
ans =
21
When you changed one element, it was no longer numerically singular. In fact, it had rank 22.
rank(Matrix2)
ans =
22
Sorry, but it is time for you to re-read those linear algebra notes.
  2 Comments
Sudipta Sinha
Sudipta Sinha on 22 May 2014
Yes, you are right. Actually there is no gurentee that those two matrices are positive and definite. But actually the 15X15 matrix is positive and definite but the overall matrix is not.
Please advise me how do i convert the singular to nonsingular matrix. or is there any other function or method that i can use for that.
Sudipta Sinha
Sudipta Sinha on 22 May 2014
please advise me how to avoid singularity and also I want to use rref function.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!