Corrcoef creating NaNs from datasets with no NaNs
이전 댓글 표시
I have been trying to analyse correlations between temperature and pressure fields or a temperature field and a time series and for some reason even though neither the temperature or pressure datasets have any NaNs in them corrcoef is producing NaNs.
What reasons are there for this to happen?
The NaNs that are being produced are propagating through my program and causing problems with the output.
답변 (2개)
Youssef Khmou
2013년 9월 24일
hi, because your data contain similar values, here is an example :
corrcoef([ones(4,1) ones(4,1)])
Sean de Wolski
2013년 9월 24일
corrcoef(zeros(10,1),zeros(10,1))
They'll occur from 0/0 or inf/inf
댓글 수: 2
Rhiannon
2013년 9월 24일
Sean de Wolski
2013년 9월 24일
편집: Sean de Wolski
2013년 9월 24일
It's hard to say without seeing the data. You could run the following and then run your code:
dbstop if naninf
Which will stop with the debugger when the NaN is calculated and you can inspect what's going on.
카테고리
도움말 센터 및 File Exchange에서 NaNs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!