Corrcoef creating NaNs from datasets with no NaNs

3 visualizaciones (últimos 30 días)
Rhiannon
Rhiannon el 24 de Sept. de 2013
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.

Respuestas (2)

Youssef  Khmou
Youssef Khmou el 24 de Sept. de 2013
hi, because your data contain similar values, here is an example :
corrcoef([ones(4,1) ones(4,1)])

Sean de Wolski
Sean de Wolski el 24 de Sept. de 2013
corrcoef(zeros(10,1),zeros(10,1))
They'll occur from 0/0 or inf/inf
  2 comentarios
Rhiannon
Rhiannon el 24 de Sept. de 2013
The values in both datasets are quite different to each other. The temperature is around 250-300, pressure 950-1050 and the time series is -10-20
Sean de Wolski
Sean de Wolski el 24 de Sept. de 2013
Editada: Sean de Wolski el 24 de Sept. de 2013
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.

Iniciar sesión para comentar.

Categorías

Más información sobre NaNs 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