Unexpected matlab operator Covariance
조회 수: 2 (최근 30일)
이전 댓글 표시
I'm trying to calculate the the covariance of a set of data using stats::covariance but I keep getting an error message saying 'Unexpected Matlab operator'. The code I used was:
stats::covariance([1, 2, 6, 9],[5, 9, 3, 7], Population])
I don't see the error in the code. Is there is another way of calculating the covariance?
댓글 수: 0
채택된 답변
Walter Roberson
2013년 4월 6일
stats::covariance is a MuPAD routine that cannot be called directly from MATLAB. Use
feval(symengine, 'stats::covariance', [1, 2, 6, 9], [6, 9, 3, 7], Population)
댓글 수: 2
Walter Roberson
2013년 9월 9일
Ah, it is a keyword for that MuPAD call, not a variable you are passing in.
Try these two variations:
feval(symengine, 'stats::covariance', [1, 2, 6, 9], [6, 9, 3, 7], 'Population')
feval(symengine, 'stats::covariance', [1, 2, 6, 9], [6, 9, 3, 7], sym('Population'))
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MuPAD에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!