필터 지우기
필터 지우기

Why cov doesn't return a semi definite positive matrix ?

조회 수: 5 (최근 30일)
Mayssa
Mayssa 2017년 5월 11일
편집: Mayssa 2017년 5월 22일
I have a matrix of features and based on that, I need to compute a semi definite positive matrix (covariance matrix) for testing purposes, so I naturally used "cov" but when I tested the semidefinite positiveness of the output, results were not satisfying. Is there another function that can do the job ? or may be another way to compute the desired covariance matrix.
Thank you!
  댓글 수: 1
Mayssa
Mayssa 2017년 5월 22일
편집: Mayssa 2017년 5월 22일
For those who may be interested, this can solve the problem: https://www.mathworks.com/matlabcentral/fileexchange/42885-nearestspd

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2017년 5월 11일
편집: Matt J 2017년 5월 11일
The non-positive definiteness is probably due to floating point calculation errors. You cannot avoid this if your cov matrix is close to singular. Remove linearly dependent data from your covariance calculations. Or, just set eigenvalues below a certain threshold to zero.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Hypothesis Tests에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by