MATLAB covariance function Cov

Source: Internet
Author: User

Interpretation of The COV function in MATLAB 1. Variance and covariance matrix of Vectors Cov (X) Returns the variance of vector X. Cov (X) is a numerical value. The formula for calculating the value is S (X ). Cov (x, y) Returns the covariance matrix of X and Y. Cov (X, Y) is a 2*2 matrix, [S (x) C (x, y); C (Y, x) S (y);] 2. Matrix Covariance Matrix Cov (X) Returns the covariance of X. Diag (COV (x) returns the variance of each column vector. SQRT (DIAG (COV (X) returns the standard deviation of each column. If X is M * n, The COV (x) size is N * n matrix. The (I, j) element of Cov (X) is equal to the variance between the column I vector of X and the column J vector, that is, C (XI, XJ ). Cov (x, y) Returns the covariance between x and y. If X is M * n and Y is K * P The size of X and Y must meet M * n = K * P That is, the number of elements X and Y is the same. At this time, Cov (x, y) Equal to the values of Cov ([x (:) y (:)]) and Cov (x (:), y (:)) The covariance matrix of the two vectors is calculated and the result is a 2*2 matrix. [S (x (:)) C (x (:), y (:)); C (Y (:), x (:)) S (Y (:));] can be seen, S (x) = C (x, x ). 3. Normalization In the above S (x), C (x, y) calculation, the normalized parameter is 1/(N-1), where N is the number of elements in the vector. The following call method uses the normalization parameter 1/N. Shows the corresponding formula. Cov (x, 1) Returns the variance of vector X. The calculation method is cov (x), but the normalization parameter is 1/N. Cov (X, Y, 1) Returns the covariance matrix of X and Y. The calculation method is cov (x, y), but the normalization parameter is 1/N. 4. PS: For differentiated treatment, Cov (X) is recorded as Cov (x, 0) Cov (X, Y) is recorded as Cov (X, Y, 0) Cov (X) Also recorded Cov (x , 0) Cov (x, y) Again Recorded as Cov (X, Y , 0) If the normalization parameter is 1/(N-1), the parameter is automatically adjusted to 1/n when n = 1.

MATLAB covariance function Cov

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.