Correlation nans

1 回表示 (過去 30 日間)
Mate 2u
Mate 2u 2012 年 6 月 1 日
Hi all,
I have a very large matrix of 1's, -1's and 0's. When I do corrcoef sometimes I get nans. Is there a way I can avoid getting nans?

回答 (1 件)

Oleg Komarov
Oleg Komarov 2012 年 6 月 1 日
0/0
ans =
NaN
Since corr(A, B) = cov(A,B)/(std(A) *std(B)) when you have that the two segments are all zeros, then you will get NaN.
You cannot avoid it but you can decide that the NaN is informative in that case.

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by