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 9133991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:35:00+00:00 2026-06-17T08:35:00+00:00

I have two vectors: A_1 = 10 200 7 150 A_2 = 0.001 0.450

  • 0

I have two vectors:

A_1 = 

      10
      200
      7
      150

A_2 = 
      0.001
      0.450
      0.0007
      0.200

I would like to know if there is correlation between these two vectors.

I could subtract to each value the mean of the vector and than do:

  A_1' * A_2

Are there any better ways?

  • 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-06-17T08:35:01+00:00Added an answer on June 17, 2026 at 8:35 am

    Given:

    A_1 = [10 200 7 150]';
    A_2 = [0.001 0.450 0.007 0.200]';
    

    (As others have already pointed out) There are tools to simply compute correlation, most obviously corr:

    corr(A_1, A_2);  %Returns 0.956766573975184  (Requires stats toolbox)
    

    You can also use base Matlab’s corrcoef function, like this:

    M = corrcoef([A_1 A_2]):  %Returns [1 0.956766573975185; 0.956766573975185 1];
    M(2,1);  %Returns 0.956766573975184 
    

    Which is closely related to the cov function:

    cov([condition(A_1) condition(A_2)]);
    

    As you almost get to in your original question, you can scale and adjust the vectors yourself if you want, which gives a slightly better understanding of what is going on. First create a condition function which subtracts the mean, and divides by the standard deviation:

    condition = @(x) (x-mean(x))./std(x);  %Function to subtract mean AND normalize standard deviation
    

    Then the correlation appears to be (A_1 * A_2)/(A_1^2), like this:

    (condition(A_1)' * condition(A_2)) / sum(condition(A_1).^2);  %Returns 0.956766573975185
    

    By symmetry, this should also work

    (condition(A_1)' * condition(A_2)) / sum(condition(A_2).^2); %Returns 0.956766573975185
    

    And it does.

    I believe, but don’t have the energy to confirm right now, that the same math can be used to compute correlation and cross correlation terms when dealing with multi-dimensiotnal inputs, so long as care is taken when handling the dimensions and orientations of the input arrays.

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

Sidebar

Related Questions

I have two vectors, v1 and v2. I would like to find any of
I have two vectors, and I would like to fill the first one with
So I have two vectors of data points, and I would like to make
I have two vectors x and y . I would like to get a
I have two vectors of integer. I would like to identify the intervals of
i have two vectors x<-c(1,1,1,2,2,2,3,3,4,5,5,6) y<-c(a,b,c,d,e,f,g,h,i,j,k,l) I'd like to choose only those in y,
In R, I have two vectors of pairs like this: x <- c(A=5, B=1,
I have two endpoints (xa,ya) and (xb,yb) of two vectors, respectively a and b,
suppose you have two (or more) classes with private member vectors: class A {
I have two sets of vectors, set A and set B. Let's say set

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.