Why do i get "Array indices must be positive integers or logical values"?

I'm trying to build covariance matrix C of the following matrix A and I'm getting the wrong message.
A = [ 44.8000 68.8000 11.4000 93.8000 93.8000 93.8000 15.8000; 55.7000 87.2000 12.9000 137.4000 137.4000 137.4000 18.8000; 59.1000 104.9000 20.7000 276.9000 276.9000 276.9000 21.4000; 63.4000 106.6000 20.1000 262.4000 262.4000 262.4000 21.7000; 70.7000 112.8000 30.2000 286.0000 286.0000 286.0000 27.7000; 88.0000 168.3000 71.1000 434.1000 434.1000 434.1000 39.5000]
Trial>> C=cov(A) Array indices must be positive integers or logical values.

답변 (2개)

Steven Lord
Steven Lord 2018년 10월 2일

3 개 추천

Rename and/or delete the variable named cov you've created that shadows the built-in cov function.
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 10월 2일
편집: KALYAN ACHARJYA 2018년 10월 2일
%No Error
A=[44.8000 68.8000 11.4000 93.8000 93.8000 93.8000 15.8000; 55.7000 87.2000 12.9000 137.4000 137.4000 137.4000 18.8000; 59.1000 104.9000 20.7000 276.9000 276.9000 276.9000 21.4000; 63.4000 106.6000 20.1000 262.4000 262.4000 262.4000 21.7000; 70.7000 112.8000 30.2000 286.0000 286.0000 286.0000 27.7000; 88.0000 168.3000 71.1000 434.1000 434.1000 434.1000 39.5000];
C=cov(A)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2018년 10월 2일

댓글:

2018년 10월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by