how to caculate covariance matrix?

1 Ansicht (letzte 30 Tage)
bay rem
bay rem am 10 Dez. 2015
Kommentiert: Walter Roberson am 10 Dez. 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)

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 10 Dez. 2015
cov(double(m))
  2 Kommentare
bay rem
bay rem am 10 Dez. 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 am 10 Dez. 2015
Yes.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by