how to caculate covariance matrix?

1 次查看(过去 30 天)
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)

采纳的回答

Walter Roberson
Walter Roberson 2015-12-10
  2 个评论
bay rem
bay rem 2015-12-10
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by