Borrar filtros
Borrar filtros

how to caculate covariance matrix?

3 visualizaciones (últimos 30 días)
bay rem
bay rem el 10 de Dic. de 2015
Comentada: Walter Roberson el 10 de Dic. de 2015
i tried to calculate covariance of matrix but an error appeared:
here is my matrix (3*3):
m=
26 197 27 197 28 197
26 196 27 196 28 196
26 195 27 195 28 195
where(26,197) describe piwel's position
and this is the error:
Error using bsxfun
Mixed integer class inputs are not supported.
Error in cov (line 154)
xc = bsxfun(@minus,x,sum(x,1)/m); % Remove mean
Error in fourptm (line 155)
c=cov(m)

Respuesta aceptada

Walter Roberson
Walter Roberson el 10 de Dic. de 2015
cov(double(m))
  2 comentarios
bay rem
bay rem el 10 de Dic. de 2015
thank you so much i already tried it, but Is it right to find such result:
0 0 0 0 0 0
0 1 0 1 0 1
0 0 0 0 0 0
0 1 0 1 0 1
0 0 0 0 0 0
0 1 0 1 0 1
Walter Roberson
Walter Roberson el 10 de Dic. de 2015
Yes.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by