Line | |
---|
1 | function N = nulleps(M,tol,maxrank) |
---|
2 | % Find the nullspace of M. This is the regular nullspace, augmented by |
---|
3 | % vectors that aren't really in the nullspace, but have low singular |
---|
4 | % values associated with them. tol is the threshold on these singular values. |
---|
5 | |
---|
6 | % maxrank indicates the maximum rank that M can be expected to have. All but the |
---|
7 | % first MAXRANK singular values can be assumed to be due to noise. Ideally, this |
---|
8 | % should be treated in a unified way with the tolerance, and one should detect |
---|
9 | % whether results seem unstable when the MAXRANK singular value is near to the |
---|
10 | % MAXRANK+1. |
---|
11 | if maxrank == -1 |
---|
12 | maxrank = min(size(M)); |
---|
13 | end |
---|
14 | |
---|
15 | [u,s,v] = svd(M); |
---|
16 | sigsvs = min(maxrank, sum(diag(s)>tol)); |
---|
17 | N=u(:,sigsvs+1:size(u,2)); |
---|
Note: See
TracBrowser
for help on using the repository browser.