Covariance calculation like excel formula

조회 수: 1 (최근 30일)
amir khalighi
amir khalighi 2018년 4월 6일
편집: Pawel Jastrzebski 2018년 4월 18일
Hi When I calculate covariance in excel it gives me a number but in matlab it gives me a matrix,why is that?and how can I get the covariance amount like excel? thanks

채택된 답변

Pawel Jastrzebski
Pawel Jastrzebski 2018년 4월 6일
편집: Pawel Jastrzebski 2018년 4월 18일
Given the code:
A = randi([18 22], 20,1)
B = randi([15 25], 20,1)
C = cov(A,B)
This is the outcome that you'll get:
>> C
C =
1.6947 -0.2842
-0.2842 6.8842
The same data in excel produces the following:
So you get the same values. Read up the documentation for covariance. This is why you get a matrix of the results:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by