why is corrcoef returning NaN's?

3 visualizaciones (últimos 30 días)
59morgan
59morgan el 30 de Mzo. de 2016
Comentada: the cyclist el 30 de Mzo. de 2016
I'm passing in a single matrix, lots of rows (est 5k), 2 cols -- there are no NaNs in the data, and the data is all doubles, for example:
101.340000000000 139.359000000000
101.500000000000 139.630000000000
101.440000000000 139.920000000000
101.350000000000 139.950000000000
101.135000000000 139.940000000000
any thoughts? thanks

Respuesta aceptada

the cyclist
the cyclist el 30 de Mzo. de 2016
Editada: the cyclist el 30 de Mzo. de 2016
I suggest you do one of two things to debug this:
(1)
Upload the actual data here, in a MAT file
(2)
Use corrcoef on sections of your matrix at a time. For example, if your matrix is M, and is 5000x2, then try
corrcoef(M(1:2500,:))
and
corrcoef(M(2501:end,:))
At least one of those two will again give a NaN result. Suppose it is the first one. Then you could similarly split it
corrcoef(M(1:1250,:))
and
corrcoef(M(1251:2500,:))
and so on until you isolate a smaller matrix that give the problem, which you may than be able to just eyeball.
  2 comentarios
59morgan
59morgan el 30 de Mzo. de 2016
ah. right. there were some nans in there... thx
the cyclist
the cyclist el 30 de Mzo. de 2016
I guess I should have first suggested
any(isnan(M(:)))
Glad it worked out.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by