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

  • Home
  • SEARCH
  • 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 8514459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:52:30+00:00 2026-06-11T04:52:30+00:00

I am using xcorr2(A,A) for computing the auto-correlation. But, the output is bigger than

  • 0

I am using xcorr2(A,A) for computing the auto-correlation. But, the output is bigger than A. How I should trim the output to find the correct auto-correlation matrix? For example, my A matrix is 51×51 and the output will be 101×101. It is clear that the central point has the maximum correlation with itself which in this case is located in (26,26), but in the new auto-correlation map, it is located in (51,51). I need a general way to trim the final output.

  • 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-11T04:52:32+00:00Added an answer on June 11, 2026 at 4:52 am

    In general you have to take M points from M/2 to 3M/2 in the 1st dimension, and N points from N/2 to 3N/2 in the 2nd dimension, assuming A is an M-by-N matrix:

    [M, N] = size(A);
    cor = xcorr2(A);  %# Shorter form of xcorr(A, A)
    C = cor(ceil(M / 2):floor(3 * M / 2), ceil(N / 2):floor(3 * N / 2))
    

    Here C would be the trimmed output.

    EDIT:
    For any two matrices A and B, the result of xcorr2(A, B) would be a (MA+MB-1)×(NA+NB-1) matrix. Here, however, you’ll have to decide for yourself which part you want to extract, if the matrices are not of equal dimensions. If you want to extract the significant central part, you can do it like so:

    [MA, NA] = size(A);
    [MB, NB] = size(B);
    v = [MA + MB, NA + NB] / 4; %# Just a temporary vector
    cor = xcorr2(A, B);
    C = cor(ceil(v(1)):floor(3 * v(1)), ceil(v(2)):floor(3 * v(2))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the navigator.geolocation object in JavaScript. Trying to establish accurate ranges, but wondering exactly
Using jQuery, one can easily find out whether a particular element is visible using
Using NSDateComponents I know how to get the day component, but this gives me
Using Xcode4.2.1, with a basic PhoneGap template based app. (I say template, but I
Using the current request I can get the URL hostname with: HttpContext.Current.Request.Url.Host But -
In R , I am using ccf or acf to compute the pair-wise cross-correlation
Using Adobe AIR for Android, I'd like to find a way to distinguish a
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using Rails 3, but I guess doesn't matter. I put this in the template
Using C#, I want to show the image in the Access column but failed

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.