CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Computing Cross-Correlation Matrix, and multiplying Result by Correlated Vars

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 16, 2022, 23:47
Wink Computing Cross-Correlation Matrix, and multiplying Result by Correlated Vars
  #1
New Member
 
Join Date: Mar 2022
Posts: 23
Rep Power: 4
loesung is on a distinguished road
Hello friends,
  1. In the context of turbulent flows, I want to compute a spatially cross-correlation matrix R(r,r',t,t') of fourier-transformed velocity field (in one direction u), using either python or matlab, and then do the explicit multiplication

    \,\,\,\,\,\,\,\,\,\,\sqrt{r}\cdot R(r,r',t,t')\cdot \sqrt{r{'}}R \,\,\,\,\,\,\,\,\,\,\,\,\, (\dagger)

  2. Matlab has the function in the signals toolbox xcorr(), but I am not sure how to explictly do the above calculation with the r and r' parameters multiplying the result of xcorr.
  3. The problem in using matlab's xcorr(), is that there is not explicit access to the r,r' variables, so if I were to calculate just xcorr(var1,var2), then I don't see how to multiply the result by r and r' - perhaps I can achieve this with some sort of weighted xcorr? But I am not sure that's what I need.

    Another question is,
  4. Since I am correlating in space and time, do I need to use something like xcorr2() (or its python equivalent)?
  5. If I am correlating two vectors of length say 3, then xcorr returns a vector of length 2*3-1=5. I am also confused on this point, why the return value is this length
loesung is offline   Reply With Quote

Old   March 17, 2022, 15:07
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,752
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
I simply don't understand what you are trying to calculate in 1) to contribute towards 1-3.

4) xcorr2 does perform correlation in both directions of the matrix. But I'm not sure if this gives you what you want in 1). If your data was arranged in two spatial dimensions, xcorr2 would give you the two-dimensional spatial correlation function. If your data is arranged in space-time, it gives you a spatial correlation and and a temporal correlation. But is this what you want?

5). A pair of 3-element vectors has 5 possible shifts. -2,-1,0,+1, and +2. The generalized cross-correlation therefore is a 5-element vector. What length were you expecting? If you do not permit zero padding and expected a single scalar output, then the element in the middle of the output contains the zero shift. +3, -3, and greater shifts would result in either a periodic shift or a null output depending on your definition of cross-correlation. In either case, there is no output needed for shifts exceeding -2 or +2 and so the output is no more than a 5 element vector.
LuckyTran is offline   Reply With Quote

Old   March 17, 2022, 15:19
Default
  #3
New Member
 
Join Date: Mar 2022
Posts: 23
Rep Power: 4
loesung is on a distinguished road
I stumbled across a book, "Particle Image Velocimetry: a Practical Guide" after posting this question, which clarified everything (in the Chapter 5: Image Evaluation Methods for PIV)
loesung is offline   Reply With Quote

Reply

Tags
correlations, turbulence analysis


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 01:31.