nullspace.m

来自「小波变换所有常见例程」· M 代码 · 共 53 行

M
53
字号
function Z = nullspace(A)

% NULLSPACE --  find nullspace of a matrix
%
%         Z = nullspace(A)
%
% This does essentially the same thing as the Matlab system
% routine NULL, except it uses the tolerance parameter MPOLY_TOLERANCE
% instead of the Matlab default tolerance.
%
% I found this to be necessary for some calculations with larger
% biorthogonal wavelets, where the Matlab system routine would not
% report the correct approximation order.
%
% If A is symbolic, call the system routine without the tolerance parameter.

% Copyright (c) 2004 by Fritz Keinert (keinert@iastate.edu),
% Dept. of Mathematics, Iowa State University, Ames, IA 50011.
% This software may be freely used and distributed for non-commercial
% purposes, provided this copyright statement is preserved, and
% appropriate credit for its use is given.
%
% Last update: Feb 20, 2004

global MPOLY_TOLERANCE

if isempty(MPOLY_TOLERANCE)
    tol = 1.e-12;
else
    tol = MPOLY_TOLERANCE;
end

% If A is symbolic, call the system routine
if (isa(A,'sym'))
    A = simplify(A);
    Z = null(A);
    Z = simplify(Z);
    return
end

% find the nullspace within tolerance tol
[m,n] = size(A);
[U,S,V] = svd(A,0);
if m > 1 
    s = diag(S);
elseif m == 1
    s = S(1);
else 
    s = 0;
end
r = sum(s > tol);
Z = V(:,r+1:n);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?