フィルターのクリア

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 Center および File ExchangeHypothesis Tests についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by