Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Tweaking Singular Matrices
Replies: 12   Last Post: Mar 22, 2012 3:37 PM

 Messages: [ Previous | Next ]
 Bjorn Gustavsson Posts: 430 Registered: 12/7/04
Re: Tweaking Singular Matrices
Posted: Mar 21, 2012 7:20 PM

"Cory" wrote in message <jkde2j\$dmh\$1@newscl01ah.mathworks.com>...
> Hi all,
>
> In some code I am writing, there will occasionally be some regularities in the problem that yield (essentially) singular matrices which I am supposed to use to solve a system of linear equations. As an illustrative example, I might have:
>
> A = [1 2 3 0 0; 4 5 6 0 0; 7 8 9 0 0; 0 0 0 1 -1; 0 0 0 -1 1]
> b = [1; 2; 3; 0; 0]
>
> and I want to solve Ax = b. Of course there are multiple solutions.
>
> What is the easiest way for MATLAB to detect which rows are part of a non-singular portion so I can substitute an arbitrary value in for those equations. e.g. in the figure above, I would want to substitute an arbitrary equation for the 4th or 5th one.
>
> I can think of some awkward ways to do this, but would appreciate any advice on the most elegant way.
>

Shouldn't this be what singular value decomposition is for?
[U,S,V] = svd(A);
indx_true_null = find(diag(S)==0);
indx_num_null = find(diag(S)<eps); % perhaps diag(S)/max(diag(S))<eps
% In null:
V(:,indx_true_null)
% In numerical null:
V(:,indx_num_null)

I guess you could use matlab's null function as well.

My 5 p.
Bjorn

Date Subject Author
3/21/12 Cory
3/21/12 Nasser Abbasi
3/21/12 Bruno Luong
3/21/12 Cory
3/21/12 Cory
3/21/12 Bruno Luong
3/21/12 Cory
3/22/12 Bruno Luong
3/22/12 Cory
3/22/12 Bruno Luong
3/21/12 Cory
3/21/12 Bruno Luong
3/21/12 Bjorn Gustavsson