Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6649959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:50:10+00:00 2026-05-26T00:50:10+00:00

I have two matricies, X and Y , with each column representing multiple realizations

  • 0

I have two matricies, X and Y, with each column representing multiple realizations of a random variable;

X = [x_11  x_21  .... x_n1
     x_12  x_22  .... x_n2
      .     .    ....  .
      .     .    ....  .
     x_1m  x_2m  .... x_nm]

And where Y is a function of X: Y = f(X)

Y = [y_11  y_21  .... y_n1
     y_12  y_22  .... y_n2
      .     .    ....  .
      .     .    ....  .
     y_1m  y_2m  .... y_nm]

I want to find the covariance matrix between the variables x_n and y_n;

E{(X - E{Y}) * (Y - E{Y})^H}

Where ()^H denotes the Hermitian Transpose of the vector

In matlab, when I run cov(X,Y) on the matricies, (each 1000 trials of 20 variables) I only get a 2×2 matrix back, which leads me to believe that it is treating each matrix as a single “variable” somehow. If I concatenate the two matricies and call cov on the result:

cov( [X Y] )

I get a 40×40 matrix, with the result of cov( X ) in the top left, the result of cov( Y ) in the bottom right, and the matrix I want in the top right and bottom left, but is there a way to calculate this without having to resort to this?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:50:11+00:00Added an answer on May 26, 2026 at 12:50 am

    cov(X,Y) is equivalent to cov([x(:) y(:)]). But [x(:) y(:)] is 20000 by 2 for you, and cov() treats rows as observations and columns as dimensions, so you get a 2 by 2 covariance matrix.

    I would just implement it myself by the definition:

    bsxfun(@minus,x,mean(x))'*bsxfun(@minus,y,mean(y))/(size(x,1)-1)
    

    If you have an older version of matlab that doesn’t support bsxfun(), just use repmat().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to generate two random sets of matrices Each containing 3 digit numbers
I have two 3x3 matrices. One representing the actual state and the other in
I have two applications written in Java that communicate with each other using XML
I have two CALayer subclasses, each with their own drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx delegate. They
I have two equations I'm solving on each recursive round: X = A -
Suppose I have two matrices, each with two columns and differing numbers of row.
Have two folders with approx. 150 java property files. In a shell script, how
I have two arrays of animals (for example). $array = array( array( 'id' =>
I have two arrays of System.Data.DataRow objects which I want to compare. The rows
I have two elements: <input a> <input b onclick=...> When b is clicked, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.