How to find if a matrix is Singular in Matlab

前端 未结 5 1955
北海茫月
北海茫月 2020-12-18 21:23

I use the function below to generate the betas for a given set of guess lambdas from my optimiser.

When running I often get the following warning message:

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-18 21:34

    There are special tools designed for this problem, appropriately called "rank revealing matrix factorizations". To my best (albeit a little old) knowledge, a good enough way to decide whether a n x n matrix A is nonsingular is to go with

    det(A) <> 0 <=> rank(A) = n

    and use a rank-revealing QR factorization of A:

    AP = QR
    

    where Q is orthogonal, P is a permutation matrix and R is an upper triangular matrix with the property that the magnitude of the diagonal elements is decreased along the diagonal.

提交回复
热议问题